diff options
author | Dinh Cong Toan <toan.dinhcong@vn.bosch.com> | 2021-01-29 10:39:30 +0700 |
---|---|---|
committer | Saya Sugiura <39760799+ssugiura@users.noreply.github.com> | 2021-06-30 10:54:59 +0900 |
commit | f5a22d09b620be0c911815145f0e6486f061aecd (patch) | |
tree | 8aeaf154b79f286287de5839b2cd363b24197cca /src/console | |
parent | 1e7d374593ae34c5f1b343a213123d5385852fe7 (diff) | |
download | DLT-daemon-f5a22d09b620be0c911815145f0e6486f061aecd.tar.gz |
dlt_receive: handle exception in signal handler.
- When declare a sigaction structure to handle signal, it should be
initialized by 0 to set other fields in struct to default, which is more safety.
Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
Diffstat (limited to 'src/console')
-rw-r--r-- | src/console/dlt-receive.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c index 085648f..a302dd7 100644 --- a/src/console/dlt-receive.c +++ b/src/console/dlt-receive.c @@ -338,6 +338,9 @@ int main(int argc, char *argv[]) /* Config signal handler */ struct sigaction act; + + /* Initialize signal handler struct */ + memset(&act, 0, sizeof(act)); act.sa_handler = signal_handler; sigemptyset(&act.sa_mask); sigaction(SIGHUP, &act, 0); |