Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Catch SIGTERM in addition to SIGINT
SIGINT catches CTRL-C. However, if a user will just terminate the em100 utility by running killall without any signal argument, e.g. $ killall em100 The utility will not leave the em100 utility in a good state and and it will stop working on consecutive calls. Hence catch SIGTERM as well, to make calls killall calls non-lethal.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I1299fe197240c92ceda57fa3db90ef3b41278e1a --- M em100.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/32/47732/1
diff --git a/em100.c b/em100.c index 09cc490..e72f181 100644 --- a/em100.c +++ b/em100.c @@ -941,7 +941,7 @@ /* Set up signal handler. This is used for two reasons: * 1) to create a way to cleanly exit trace mode. * 2) to make sure that the em100 is not left in an improper state - * when receiving SIGINT for other reasons during operation. In + * when receiving SIGINT/SIGTERM for other reasons during operation. In * this second case, we just ignore SIGINT until em100 naturally * terminates or receives a second signal. This is OK because the * utility is short-running in nature. @@ -950,6 +950,7 @@ signal_action.sa_flags = 0; sigemptyset(&signal_action.sa_mask); sigaction(SIGINT, &signal_action, NULL); + sigaction(SIGTERM, &signal_action, NULL);
if (em100->hwversion == HWVERSION_EM100PRO || em100->hwversion == HWVERSION_EM100PRO_EARLY) { printf("MCU version: %d.%02d\n", em100->mcu >> 8, em100->mcu & 0xff);