diff options
author | Donald Huang <donald.huang@ite.com.tw> | 2021-09-15 10:32:07 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-22 09:59:55 +0000 |
commit | 96a380751f6ed38fcb044ccfd283454a539352fe (patch) | |
tree | 2e497dffaebab405cb74b311a53b3b80a7be1ccd /util/iteflash.c | |
parent | f75762dfbd784b76473388cf9c5cc83769a0e612 (diff) | |
download | chrome-ec-96a380751f6ed38fcb044ccfd283454a539352fe.tar.gz |
iteflash: fix sigaction
Clear sigaction to 0.
BUG=none
BRANCH=none
TEST=Check it ok by cherry platform.
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Change-Id: I5d08158bd1aa8262e2abe6917ac7c4732d22fd46
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3162463
Tested-by: Donald Huang <donald.huang@ite.corp-partner.google.com>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'util/iteflash.c')
-rw-r--r-- | util/iteflash.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util/iteflash.c b/util/iteflash.c index ba6ba21159..a4a166d3d8 100644 --- a/util/iteflash.c +++ b/util/iteflash.c @@ -23,6 +23,7 @@ #include <sys/ioctl.h> #include <time.h> #include <unistd.h> +#include <sys/wait.h> #include "compile_time_macros.h" #include "usb_if.h" @@ -2267,15 +2268,18 @@ static int parse_parameters(int argc, char **argv, struct iteflash_config *conf) static void sighandler(int signum) { + int status; printf("\nCaught signal %d: %s\nExiting...\n", signum, strsignal(signum)); - exit_requested = 1; + wait(&status); + exit_requested = status; } static void register_sigaction(void) { struct sigaction sigact; + memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = sighandler; sigemptyset(&sigact.sa_mask); sigact.sa_flags = 0; |