[PATCH libinput 06/13] test: restore the hwdb/udev rules on SIGINT

Peter Hutterer peter.hutterer at who-t.net
Tue Aug 2 02:40:51 UTC 2016


We can't call system() in the signal handler but we are allowed to fork. Do
that, update the hwdb and immediately exit the child again.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/litest.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/litest.c b/test/litest.c
index 492aa3a..2adec94 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -852,6 +852,12 @@ litest_signal(int sig)
 		/* in the sighandler, we can't free */
 	}
 
+	if (fork() == 0) {
+		/* child, we can run system() */
+		litest_reload_udev_rules();
+		exit(0);
+	}
+
 	exit(1);
 }
 
-- 
2.7.4



More information about the wayland-devel mailing list