summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-08-13 11:03:44 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-08-17 09:18:01 +1000
commit9563334dda3c5563550fb2534b228c47216ec008 (patch)
treeada358c7a72a0e9e06a3be76aac36e443d165c63
parent353c52f2bec035f04c136c8f3b28571e2a4515df (diff)
Use xf86OpenSerial instead of a direct open() call
This will transparently handle server-side fds for us. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Martin Pieuchot <mpi@openbsd.org>
-rw-r--r--src/xf86libinput.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 204f288..7ecc0e6 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -34,6 +34,7 @@
#include <exevents.h>
#include <xkbsrv.h>
#include <xf86Xinput.h>
+#include <xf86_OSproc.h>
#include <xserver-properties.h>
#include <libinput.h>
#include <linux/input.h>
@@ -923,7 +924,6 @@ open_restricted(const char *path, int flags, void *data)
char *device = xf86CheckStrOption(pInfo->options, "Device", NULL);
if (device != NULL && strcmp(path, device) == 0) {
- fd = xf86CheckIntOption(pInfo->options, "fd", -1);
free(device);
break;
}
@@ -935,8 +935,7 @@ open_restricted(const char *path, int flags, void *data)
return -ENODEV;
}
- if (fd == -1)
- fd = open(path, flags);
+ fd = xf86OpenSerial(pInfo->options);
return fd < 0 ? -errno : fd;
}
@@ -957,7 +956,7 @@ close_restricted(int fd, void *data)
}
if (!found)
- close(fd);
+ xf86CloseSerial(fd);
}
const struct libinput_interface interface = {