[PATCH 1/3] Xext/shm: Fix usage of F_GETFD to match standard

Julien Cristau jcristau at debian.org
Mon Sep 12 11:32:22 UTC 2016


On Sun, Sep 11, 2016 at 20:01:49 -0700, Jeremy Huddleston Sequoia wrote:

> flags = fcntl(fd, F_GETFD) is compliant.
> 
> fcntl(fd, F_GETFD, &flags) is non-compliant (Linux extension?)
> 
> cf: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
> ---
>  Xext/shm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
Reviewed-by: Julien Cristau <jcristau at debian.org>

Cheers,
Julien

> diff --git a/Xext/shm.c b/Xext/shm.c
> index 0557538..125000f 100644
> --- a/Xext/shm.c
> +++ b/Xext/shm.c
> @@ -1213,7 +1213,8 @@ shm_tmpfile(void)
>  	if (fd < 0)
>  		return -1;
>  	unlink(template);
> -	if (fcntl(fd, F_GETFD, &flags) >= 0) {
> +	flags = fcntl(fd, F_GETFD);
> +	if (flags != -1) {
>  		flags |= FD_CLOEXEC;
>  		(void) fcntl(fd, F_SETFD, &flags);
>  	}
> -- 
> 2.10.0 (Apple Git-99)
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list