diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2018-05-18 11:23:01 +0200 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-06-19 09:52:17 -0400 |
commit | a9a17581ce73a49f0a8d3b9dbb2db083fa44cb69 (patch) | |
tree | 2931827e3e658fe76e6c6d34c1b462dd7a88d7ee | |
parent | c3a06e330b7e55e1daeefbb5c16a075c80233bb0 (diff) |
modesetting: Pass O_CLOEXEC when opening a DRM device
We don't want DRM file descriptors to leak to child processes.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(cherry picked from commit 315c63c41d833700c505e4f21ffac4c59e1e3b2c)
-rw-r--r-- | hw/xfree86/drivers/modesetting/driver.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index 5d8906d63..306541f33 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -200,12 +200,12 @@ open_hw(const char *dev) int fd; if (dev) - fd = open(dev, O_RDWR, 0); + fd = open(dev, O_RDWR | O_CLOEXEC, 0); else { dev = getenv("KMSDEVICE"); - if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) { + if ((NULL == dev) || ((fd = open(dev, O_RDWR | O_CLOEXEC, 0)) == -1)) { dev = "/dev/dri/card0"; - fd = open(dev, O_RDWR, 0); + fd = open(dev, O_RDWR | O_CLOEXEC, 0); } } if (fd == -1) |