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>
This commit is contained in:
Chris Wilson 2013-08-22 20:42:58 +01:00
parent 92a2f8010b
commit 163b6a52a4

View File

@ -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;
}