[PATCH xf86-input-libinput 2/2] Use xf86OpenSerial instead of a direct open() call

Peter Hutterer peter.hutterer at who-t.net
Wed Aug 12 20:08:49 PDT 2015


This will transparently handle server-side fds for us.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/xf86libinput.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index b468d7f..847f95d 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>
@@ -907,7 +908,6 @@ open_restricted(const char *path, int flags, void *data)
 		char *device = xf86CheckStrOption(pInfo->options, "Device", NULL);
 
 		if (strcmp(path, device) == 0) {
-			fd = xf86CheckIntOption(pInfo->options, "fd", -1);
 			free(device);
 			break;
 		}
@@ -919,8 +919,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;
 }
 
@@ -941,7 +940,7 @@ close_restricted(int fd, void *data)
 	}
 
 	if (!found)
-		close(fd);
+		xf86CloseSerial(fd);
 }
 
 const struct libinput_interface interface = {
-- 
2.4.3



More information about the xorg-devel mailing list