summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-05-18 11:23:01 +0200
committerAdam Jackson <ajax@redhat.com>2018-05-21 13:56:41 -0400
commit315c63c41d833700c505e4f21ffac4c59e1e3b2c (patch)
tree7235e206451a9677fdd8833eff82ed201f0c5628
parentab53e2859facecc0486344679dc01ea31fb427e9 (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>
-rw-r--r--hw/xfree86/drivers/modesetting/driver.c6
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)