diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-05-18 04:06:35 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-05-18 04:06:35 +0000 |
commit | fb8054f13114a94b356f7ad0176fa981c0389de8 (patch) | |
tree | 9baa4010ec6d3d212dfab352dd84fc5abbf3ddc0 /dumpcap.c | |
parent | 60637d4b70c0b35ea6a3a307634704223b2dc283 (diff) |
Expand a comment.
Clear the struct sigaction *before* we fill in any fields in it.
svn path=/trunk/; revision=42706
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -4062,14 +4062,24 @@ main(int argc, char *argv[]) SetConsoleCtrlHandler(capture_cleanup_handler, TRUE); #else /* Catch SIGINT and SIGTERM and, if we get either of them, clean up - and exit. */ + and exit. Do the same with SIGPIPE, in case, for example, + we're writing to our standard output and it's a pipe. + Do the same with SIGHUP if it's not being ignored (if we're + being run under nohup, it might be ignored, in which case we + should leave it ignored). + + XXX - apparently, Coverity complained that part of action + wasn't initialized. Perhaps it's running on Linux, where + struct sigaction has an ignored "sa_restorer" element and + where "sa_handler" and "sa_sigaction" might not be two + members of a union. */ + memset(&action, 0, sizeof(action)); action.sa_handler = capture_cleanup_handler; /* * Arrange that system calls not get restarted, because when * our signal handler returns we don't want to restart * a call that was waiting for packets to arrive. */ - memset(&action, 0, sizeof(action)); action.sa_flags = 0; sigemptyset(&action.sa_mask); sigaction(SIGTERM, &action, NULL); |