summaryrefslogtreecommitdiff
path: root/overlay/x11
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-22 20:42:58 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-22 22:15:46 +0100
commit163b6a52a4dd44c48c40a609aa8b8b1ffc46881e (patch)
tree8f5daa3d54cf484f625e89e6bca3595d3a8aba46 /overlay/x11
parent92a2f8010b5b786c52d676e87209e8332fd370a0 (diff)
overlay: Close DRI2 device after authentication failure
So that we don't leave a master fd open when operating remotely. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/x11')
-rw-r--r--overlay/x11/dri2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/overlay/x11/dri2.c b/overlay/x11/dri2.c
index 0aa0cf53..6c9e90d6 100644
--- a/overlay/x11/dri2.c
+++ b/overlay/x11/dri2.c
@@ -39,6 +39,7 @@
#include <xf86drm.h>
#include <drm.h>
#include <fcntl.h>
+#include <unistd.h>
#include "dri2.h"
@@ -160,10 +161,14 @@ int dri2_open(Display *dpy)
return -1;
if (drmIoctl(fd, DRM_IOCTL_GET_MAGIC, &auth))
- return -1;
+ goto err_fd;
if (!DRI2Authenticate(dpy, DefaultRootWindow(dpy), auth.magic))
- return -1;
+ goto err_fd;
return fd;
+
+err_fd:
+ close(fd);
+ return -1;
}