diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-11-05 10:07:44 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-11-05 10:07:44 +0100 |
commit | ae066204654f54a72442b38a30d042bd0485cb82 (patch) | |
tree | fd40ad884d64e59d4938e10f3443d3ac0e4c33fc | |
parent | 78873f3a77132a3676f9ede018dd9c4e221e9bd0 (diff) |
Only install signal handlers in grab mode
It's not necessary to install signal handlers for SIGINT and SIGTERM
when not in grab mode, as there is nothing for evtest to do when
exiting, such as releasing the grab.
This causes problems with umockdev's event capture which relies on being
able to catch the SIGINT signal itself to know to flush its capture
buffers before exiting.
See https://github.com/martinpitt/umockdev/issues/96
-rw-r--r-- | evtest.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1248,8 +1248,10 @@ static int do_capture(const char *device, int grab_flag) printf("***********************************************\n"); } - signal(SIGINT, interrupt_handler); - signal(SIGTERM, interrupt_handler); + if (grab_flag) { + signal(SIGINT, interrupt_handler); + signal(SIGTERM, interrupt_handler); + } free(filename); |