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>
This commit is contained in:
parent
ab53e2859f
commit
315c63c41d
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue