test: restore the hwdb/udev rules on SIGINT
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 19 Jul 2016 22:45:22 +0000 (08:45 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 2 Aug 2016 00:19:38 +0000 (10:19 +1000)
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@who-t.net>
test/litest.c

index 492aa3a..2adec94 100644 (file)
@@ -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);
 }