/* capture_sync.c
- * Synchronisation between Ethereal capture parent and child instances
+ * Synchronisation between Wireshark capture parent and child instances
*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
#ifdef _WIN32
#include <fcntl.h>
-#include "epan/strutil.h"
+#include "epan/unicode-utils.h"
#endif
#ifdef HAVE_SYS_WAIT_H
enum PIPES { PIPE_READ, PIPE_WRITE }; /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */
#endif
int sync_pipe_read_fd;
+ const char *progfile_dir;
char *exename;
int argc;
const char **argv;
capture_opts->fork_child = -1;
+ progfile_dir = get_progfile_dir();
+ if (progfile_dir == NULL) {
+ /* We don't know where to find dumpcap. */
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "We don't know where to find dumpcap.");
+ return FALSE;
+ }
+
/* Allocate the string pointer array with enough space for the
terminating NULL pointer. */
argc = 0;
argv = g_malloc(sizeof (char *));
*argv = NULL;
- /* take ethereal's absolute program path and replace "ethereal" with "dumpcap" */
- exename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "dumpcap",
- get_progfile_dir());
+ /* take Wireshark's absolute program path and replace "Wireshark" with "dumpcap" */
+ exename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "dumpcap", progfile_dir);
/* Make that the first argument in the argument list (argv[0]). */
argv = sync_pipe_add_arg(argv, &argc, exename);
/* associate the operating system filehandle to a C run-time file handle */
capture_opts->signal_pipe_write_fd = _open_osfhandle( (long) signal_pipe_write, _O_BINARY);
- /* child own's the read side now, close our handle */
+ /* child owns the read side now, close our handle */
CloseHandle(signal_pipe_read);
#else /* _WIN32 */
if (pipe(sync_pipe) < 0) {
if ((capture_opts->fork_child = fork()) == 0) {
/*
- * Child process - run Ethereal with the right arguments to make
- * it just pop up the live capture dialog box and capture with
- * the specified capture parameters, writing to the specified file.
+ * Child process - run dumpcap with the right arguments to make
+ * it just capture with the specified capture parameters
*/
eth_close(1);
dup(sync_pipe[PIPE_WRITE]);
eth_close(sync_pipe[PIPE_READ]);
- execv(exename, argv);
+ execv(exename, (gpointer)argv);
g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
exename, strerror(errno));
sync_pipe_errmsg_to_parent(errmsg, "");
}
-/* Ethereal has to exit, force the capture child to close */
+/* Wireshark has to exit, force the capture child to close */
void
sync_pipe_kill(capture_options *capture_opts)
{