diff options
author | Bill Meier <wmeier@newsguy.com> | 2008-03-21 02:27:58 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2008-03-21 02:27:58 +0000 |
commit | e4f89044bda90bb778fe40a0d40be467798dcfb5 (patch) | |
tree | cc16646b88b34cb5bcc32764053d8efb9ff77be1 /capture_sync.c | |
parent | 6c2c608bae464ee93dfcc9657498fb70494f292d (diff) |
Emit warning message to log if attempt to send signal to child process fails...
svn path=/trunk/; revision=24707
Diffstat (limited to 'capture_sync.c')
-rw-r--r-- | capture_sync.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/capture_sync.c b/capture_sync.c index aa6c8c987c..c026f18bf7 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -1432,7 +1432,11 @@ sync_pipe_stop(capture_options *capture_opts) if (capture_opts->fork_child != -1) { #ifndef _WIN32 /* send the SIGUSR1 signal to close the capture child gracefully. */ - kill(capture_opts->fork_child, SIGUSR1); + int sts = kill(capture_opts->fork_child, SIGUSR1); + if (sts != 0) { + g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_WARNING, + "Sending SIGUSR1 to child failed: %s\n", strerror(errno)); + } #else #define STOP_SLEEP_TIME 500 /* ms */ #define STOP_CHECK_TIME 50 @@ -1466,9 +1470,13 @@ sync_pipe_stop(capture_options *capture_opts) void sync_pipe_kill(int fork_child) { - if (fork_child != -1) { + if (fork_child != -1) { #ifndef _WIN32 - kill(fork_child, SIGTERM); /* SIGTERM so it can clean up if necessary */ + int sts = kill(fork_child, SIGTERM); /* SIGTERM so it can clean up if necessary */ + if (sts != 0) { + g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_WARNING, + "Sending SIGTERM to child failed: %s\n", strerror(errno)); + } #else /* Remark: This is not the preferred method of closing a process! * the clean way would be getting the process id of the child process, @@ -1488,9 +1496,9 @@ sync_pipe_kill(int fork_child) * us, as we might not be running in a console. * And this also will require to have the process id. */ - TerminateProcess((HANDLE) (fork_child), 0); + TerminateProcess((HANDLE) (fork_child), 0); #endif - } + } } #endif /* HAVE_LIBPCAP */ |