From 51fb42cb602ed08f14b49121e02dbf0c5c5e1877 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 Jul 2016 08:45:22 +1000 Subject: [PATCH] test: restore the hwdb/udev rules on SIGINT 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 --- test/litest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/litest.c b/test/litest.c index 492aa3ac..2adec941 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); }