dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libdrm] Always pass O_CLOEXEC when opening DRM file descriptors
@ 2018-05-18  9:17 Michel Dänzer
  2018-05-18 10:50 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Michel Dänzer @ 2018-05-18  9:17 UTC (permalink / raw)
  To: dri-devel

From: Michel Dänzer <michel.daenzer@amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 xf86drm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 3a9d0ed2..c09437b0 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -405,7 +405,7 @@ wait_for_udev:
     }
 #endif
 
-    fd = open(buf, O_RDWR, 0);
+    fd = open(buf, O_RDWR | O_CLOEXEC, 0);
     drmMsg("drmOpenDevice: open result is %d, (%s)\n",
            fd, fd < 0 ? strerror(errno) : "OK");
     if (fd >= 0)
@@ -425,7 +425,7 @@ wait_for_udev:
             chmod(buf, devmode);
         }
     }
-    fd = open(buf, O_RDWR, 0);
+    fd = open(buf, O_RDWR | O_CLOEXEC, 0);
     drmMsg("drmOpenDevice: open result is %d, (%s)\n",
            fd, fd < 0 ? strerror(errno) : "OK");
     if (fd >= 0)
@@ -474,7 +474,7 @@ static int drmOpenMinor(int minor, int create, int type)
     };
 
     sprintf(buf, dev_name, DRM_DIR_NAME, minor);
-    if ((fd = open(buf, O_RDWR, 0)) >= 0)
+    if ((fd = open(buf, O_RDWR | O_CLOEXEC, 0)) >= 0)
         return fd;
     return -errno;
 }
-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH libdrm] Always pass O_CLOEXEC when opening DRM file descriptors
  2018-05-18  9:17 [PATCH libdrm] Always pass O_CLOEXEC when opening DRM file descriptors Michel Dänzer
@ 2018-05-18 10:50 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2018-05-18 10:50 UTC (permalink / raw)
  To: Michel Dänzer, dri-devel

Am 18.05.2018 um 11:17 schrieb Michel Dänzer:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   xf86drm.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/xf86drm.c b/xf86drm.c
> index 3a9d0ed2..c09437b0 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -405,7 +405,7 @@ wait_for_udev:
>       }
>   #endif
>   
> -    fd = open(buf, O_RDWR, 0);
> +    fd = open(buf, O_RDWR | O_CLOEXEC, 0);
>       drmMsg("drmOpenDevice: open result is %d, (%s)\n",
>              fd, fd < 0 ? strerror(errno) : "OK");
>       if (fd >= 0)
> @@ -425,7 +425,7 @@ wait_for_udev:
>               chmod(buf, devmode);
>           }
>       }
> -    fd = open(buf, O_RDWR, 0);
> +    fd = open(buf, O_RDWR | O_CLOEXEC, 0);
>       drmMsg("drmOpenDevice: open result is %d, (%s)\n",
>              fd, fd < 0 ? strerror(errno) : "OK");
>       if (fd >= 0)
> @@ -474,7 +474,7 @@ static int drmOpenMinor(int minor, int create, int type)
>       };
>   
>       sprintf(buf, dev_name, DRM_DIR_NAME, minor);
> -    if ((fd = open(buf, O_RDWR, 0)) >= 0)
> +    if ((fd = open(buf, O_RDWR | O_CLOEXEC, 0)) >= 0)
>           return fd;
>       return -errno;
>   }

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-18 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18  9:17 [PATCH libdrm] Always pass O_CLOEXEC when opening DRM file descriptors Michel Dänzer
2018-05-18 10:50 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).