glx: Use loader_open_device() helper
We've moved the open with CLOEXEC idiom into a helper function, so call it instead of duplicating the code here. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
9c92746349
commit
324ee9b391
|
@ -1183,15 +1183,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef O_CLOEXEC
|
psc->fd = loader_open_device(deviceName);
|
||||||
psc->fd = open(deviceName, O_RDWR | O_CLOEXEC);
|
|
||||||
if (psc->fd == -1 && errno == EINVAL)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
psc->fd = open(deviceName, O_RDWR);
|
|
||||||
if (psc->fd != -1)
|
|
||||||
fcntl(psc->fd, F_SETFD, fcntl(psc->fd, F_GETFD) | FD_CLOEXEC);
|
|
||||||
}
|
|
||||||
if (psc->fd < 0) {
|
if (psc->fd < 0) {
|
||||||
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
||||||
goto handle_error;
|
goto handle_error;
|
||||||
|
|
Loading…
Reference in New Issue