aboutsummaryrefslogtreecommitdiffstats
path: root/capture_sync.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2006-02-12 03:15:29 +0000
committerGuy Harris <guy@alum.mit.edu>2006-02-12 03:15:29 +0000
commitb8136fbfa9ba5cafbd7182f82b58759ee14a6555 (patch)
treef9d78126da180e876f8d40f12089268530ce1aca /capture_sync.c
parent9bc8780a661260a2446f556914cced07644999b9 (diff)
Add a routine to attempt to get the absolute pathname of the executable
file, strip off the last component to get the pathname of the directory containing the executable file, and save it for future use. On Windows, you can get that from the OS, but, on UN*X, you have to look at argv[0] and derive the absolute path from that (argv[0] is not guaranteed to be an absolute path, or even a path at all). (In addition, if you're running from the build directory, you might have to strip off a ".libs/" added to argv[0] as an artifact of the libtoolizing script.) Use that in the About dialog, and use it to construct the path of dumpcap. Don't put quotes into the path of dumpcap; you don't have to quote strings with spaces in them when handing them to execvp and, in fact, you *mustn't* quote them, as the quotes will be treated as part of the pathname. svn path=/trunk/; revision=17267
Diffstat (limited to 'capture_sync.c')
-rw-r--r--capture_sync.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/capture_sync.c b/capture_sync.c
index 56ee2ef9b3..2e99e86263 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -301,7 +301,6 @@ 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;
- char *dirname;
char *exename;
int argc;
const char **argv;
@@ -391,9 +390,8 @@ sync_pipe_start(capture_options *capture_opts) {
#endif
/* take ethereal's absolute program path and replace ethereal with dumpcap */
- dirname = get_dirname(g_strdup(ethereal_path));
- exename = g_strdup_printf("\"%s" G_DIR_SEPARATOR_S "dumpcap\"", dirname);
- g_free(dirname);
+ exename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "dumpcap",
+ get_progfile_dir());
#ifdef _WIN32
argv = sync_pipe_add_arg(argv, &argc, "-B");