forked from osmocom/wireshark
fix #199: encapsulate capture filename, to avoid problems with spaces in the filename (win32 only)
svn path=/trunk/; revision=14432
This commit is contained in:
parent
d22b1f3cbe
commit
fbe12a9a22
|
@ -328,6 +328,7 @@ sync_pipe_start(capture_options *capture_opts) {
|
||||||
char signal_pipe_fd[ARGV_NUMBER_LEN];
|
char signal_pipe_fd[ARGV_NUMBER_LEN];
|
||||||
char *fontstring;
|
char *fontstring;
|
||||||
char *filterstring;
|
char *filterstring;
|
||||||
|
char *savefilestring;
|
||||||
int signal_pipe[2]; /* pipe used to send messages from parent to child (currently only stop) */
|
int signal_pipe[2]; /* pipe used to send messages from parent to child (currently only stop) */
|
||||||
#else
|
#else
|
||||||
char errmsg[1024+1];
|
char errmsg[1024+1];
|
||||||
|
@ -355,11 +356,6 @@ sync_pipe_start(capture_options *capture_opts) {
|
||||||
argv = sync_pipe_add_arg(argv, &argc, "-i");
|
argv = sync_pipe_add_arg(argv, &argc, "-i");
|
||||||
argv = sync_pipe_add_arg(argv, &argc, capture_opts->iface);
|
argv = sync_pipe_add_arg(argv, &argc, capture_opts->iface);
|
||||||
|
|
||||||
if(capture_opts->save_file) {
|
|
||||||
argv = sync_pipe_add_arg(argv, &argc, "-w");
|
|
||||||
argv = sync_pipe_add_arg(argv, &argc, capture_opts->save_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (capture_opts->has_snaplen) {
|
if (capture_opts->has_snaplen) {
|
||||||
argv = sync_pipe_add_arg(argv, &argc, "-s");
|
argv = sync_pipe_add_arg(argv, &argc, "-s");
|
||||||
sprintf(ssnap,"%d",capture_opts->snaplen);
|
sprintf(ssnap,"%d",capture_opts->snaplen);
|
||||||
|
@ -475,12 +471,22 @@ sync_pipe_start(capture_options *capture_opts) {
|
||||||
argv = sync_pipe_add_arg(argv, &argc, filterstring);
|
argv = sync_pipe_add_arg(argv, &argc, filterstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert save file name to a quote delimited string and pass to child */
|
||||||
|
if(capture_opts->save_file) {
|
||||||
|
argv = sync_pipe_add_arg(argv, &argc, "-w");
|
||||||
|
savefilestring = sync_pipe_quote_encapsulate(capture_opts->save_file);
|
||||||
|
argv = sync_pipe_add_arg(argv, &argc, savefilestring);
|
||||||
|
}
|
||||||
|
|
||||||
/* Spawn process */
|
/* Spawn process */
|
||||||
capture_opts->fork_child = spawnvp(_P_NOWAIT, ethereal_path, argv);
|
capture_opts->fork_child = spawnvp(_P_NOWAIT, ethereal_path, argv);
|
||||||
g_free(fontstring);
|
g_free(fontstring);
|
||||||
if (filterstring) {
|
if (filterstring) {
|
||||||
g_free(filterstring);
|
g_free(filterstring);
|
||||||
}
|
}
|
||||||
|
if(savefilestring) {
|
||||||
|
g_free(savefilestring);
|
||||||
|
}
|
||||||
|
|
||||||
/* child own's the read side now, close our handle */
|
/* child own's the read side now, close our handle */
|
||||||
close(signal_pipe[PIPE_READ]);
|
close(signal_pipe[PIPE_READ]);
|
||||||
|
@ -501,6 +507,11 @@ sync_pipe_start(capture_options *capture_opts) {
|
||||||
argv = sync_pipe_add_arg(argv, &argc, capture_opts->cfilter);
|
argv = sync_pipe_add_arg(argv, &argc, capture_opts->cfilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(capture_opts->save_file) {
|
||||||
|
argv = sync_pipe_add_arg(argv, &argc, "-w");
|
||||||
|
argv = sync_pipe_add_arg(argv, &argc, capture_opts->save_file);
|
||||||
|
}
|
||||||
|
|
||||||
if ((capture_opts->fork_child = fork()) == 0) {
|
if ((capture_opts->fork_child = fork()) == 0) {
|
||||||
/*
|
/*
|
||||||
* Child process - run Ethereal with the right arguments to make
|
* Child process - run Ethereal with the right arguments to make
|
||||||
|
|
Loading…
Reference in New Issue