diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2013-06-27 19:00:01 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2013-06-27 19:00:01 +0000 |
commit | 99013aefa81f2d3e14d3e063574e6dea4045d0b1 (patch) | |
tree | 2a1e516d3c86aca5690a8725f5f51e276c0f46ac /capture_sync.c | |
parent | 16fc2c5998031c086d05cf5706ab5b5e9e2abaf2 (diff) |
MS: list interfaces!
svn path=/trunk/; revision=50195
Diffstat (limited to 'capture_sync.c')
-rw-r--r-- | capture_sync.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/capture_sync.c b/capture_sync.c index 9a2136814a..f8a6f83f28 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -118,6 +118,9 @@ static void pipe_convert_header(const guchar *header, int header_len, char *indi static ssize_t pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, char **err_msg); +static void (*fetch_dumpcap_pid)(int) = NULL; + + void capture_session_init(capture_session *cap_session, void *cf) { @@ -652,6 +655,9 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi _exit(1); } + if (fetch_dumpcap_pid && cap_session->fork_child > 0) + fetch_dumpcap_pid(cap_session->fork_child); + sync_pipe_read_fd = sync_pipe[PIPE_READ]; #endif @@ -879,6 +885,9 @@ sync_pipe_open_command(char** argv, int *data_read_fd, _exit(1); } + if (fetch_dumpcap_pid && *fork_child > 0) + fetch_dumpcap_pid(*fork_child); + *data_read_fd = data_pipe[PIPE_READ]; *message_read_fd = sync_pipe[PIPE_READ]; #endif @@ -1862,9 +1871,12 @@ sync_pipe_wait_for_child(int fork_child, gchar **msgp) fork_child_status); ret = -1; } - } else { + } else if (errno != ECHILD) { *msgp = g_strdup_printf("Error from waitpid(): %s", g_strerror(errno)); ret = -1; + } else { + /* errno == ECHILD ; echld might have already reaped the child */ + ret = fetch_dumpcap_pid ? 0 : -1; } #endif @@ -2077,4 +2089,8 @@ sync_pipe_kill(int fork_child) } } +void capture_sync_set_fetch_dumpcap_pid_cb(void(*cb)(int pid)) { + fetch_dumpcap_pid = cb; +} + #endif /* HAVE_LIBPCAP */ |