Add -Werror when using GCC only to the Makefile.am of the base
[obnox/wireshark/wip.git] / capture_sync.c
index cd2c8d845235f47a4e31f8c0a7e23bae8244eb93..4b67d0cd58759cd38ca017bcaea377a35b6ae192 100644 (file)
@@ -1,10 +1,10 @@
 /* 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
@@ -41,7 +41,7 @@
 
 #ifdef _WIN32
 #include <fcntl.h>
-#include "epan/strutil.h"
+#include "epan/unicode-utils.h"
 #endif
 
 #ifdef HAVE_SYS_WAIT_H
@@ -241,6 +241,7 @@ sync_pipe_start(capture_options *capture_opts) {
     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;
@@ -251,15 +252,21 @@ sync_pipe_start(capture_options *capture_opts) {
 
     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);
@@ -425,7 +432,7 @@ sync_pipe_start(capture_options *capture_opts) {
     /* 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) {
@@ -438,14 +445,13 @@ sync_pipe_start(capture_options *capture_opts) {
 
     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, "");
@@ -888,7 +894,7 @@ sync_pipe_stop(capture_options *capture_opts)
 }
 
 
-/* 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)
 {