aboutsummaryrefslogtreecommitdiffstats
path: root/capture_sync.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2006-04-03 01:56:53 +0000
committerGuy Harris <guy@alum.mit.edu>2006-04-03 01:56:53 +0000
commitd26000302681fde598974116f0512c5bbb7ea72c (patch)
treed287fdd29022285058e395ad0d78ec0bf7b24e69 /capture_sync.c
parentd5585760e73bfe4e200301eb93626d7a83ccd886 (diff)
Put the low-level sync routines into a common file so they can be shared
by dumpcap and Ethereal (so that, on UN*X, the child process can report a detailed "can't exec dumpcap" error). Rename most of the "sync_pipe_XXX_to_parent()" routines, as they're also in Tethereal, which doesn't have a sync pipe. svn path=/trunk/; revision=17789
Diffstat (limited to 'capture_sync.c')
-rw-r--r--capture_sync.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/capture_sync.c b/capture_sync.c
index b20ea619ae..2aa50625fd 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -89,6 +89,8 @@
#include "capture_sync.h"
#include "simple_dialog.h"
+#include "sync_pipe.h"
+
#ifdef _WIN32
#include "capture-wpcap.h"
#endif
@@ -405,11 +407,12 @@ sync_pipe_start(capture_options *capture_opts) {
/* call dumpcap */
if(!CreateProcess(NULL, utf_8to16(args->str), NULL, NULL, TRUE,
CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) {
- g_warning("Couldn't open dumpcap (Error: %u): %s", GetLastError(), args->str);
- capture_opts->fork_child = -1;
- } else {
- capture_opts->fork_child = (int) pi.hProcess;
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "Couldn't run %s in child process: error %u",
+ args->str, GetLastError());
+ return FALSE;
}
+ capture_opts->fork_child = (int) pi.hProcess;
g_string_free(args, TRUE);
/* associate the operating system filehandle to a C run-time file handle */
@@ -440,10 +443,9 @@ sync_pipe_start(capture_options *capture_opts) {
dup(sync_pipe[PIPE_WRITE]);
eth_close(sync_pipe[PIPE_READ]);
execv(exename, argv);
- /* XXX - find a way to send this message to the parent in a clean way */
- /*g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
exename, strerror(errno));
- sync_pipe_errmsg_to_parent(errmsg, "");*/
+ sync_pipe_errmsg_to_parent(errmsg, "");
/* Exit with "_exit()", so that we don't close the connection
to the X server (and cause stuff buffered up by our parent but