summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-11-05 10:07:44 +0100
committerBastien Nocera <hadess@hadess.net>2020-11-05 10:07:44 +0100
commitae066204654f54a72442b38a30d042bd0485cb82 (patch)
treefd40ad884d64e59d4938e10f3443d3ac0e4c33fc
parent78873f3a77132a3676f9ede018dd9c4e221e9bd0 (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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/evtest.c b/evtest.c
index 8d592f4..b964fb3 100644
--- a/evtest.c
+++ b/evtest.c
@@ -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);