aboutsummaryrefslogtreecommitdiffstats
path: root/capture_sync.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-05-25 17:46:04 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-05-25 17:46:04 +0000
commitfbe12a9a229bd3c815e8719fc318072cf19d820b (patch)
tree1f12a54cda9e683fc244b6d3a97e212d78b1019c /capture_sync.c
parentd22b1f3cbe547a208a1adec289da466ed307cf0d (diff)
fix #199: encapsulate capture filename, to avoid problems with spaces in the filename (win32 only)
svn path=/trunk/; revision=14432
Diffstat (limited to 'capture_sync.c')
-rw-r--r--capture_sync.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/capture_sync.c b/capture_sync.c
index 16fe008c57..d0a5feb91f 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -328,6 +328,7 @@ sync_pipe_start(capture_options *capture_opts) {
char signal_pipe_fd[ARGV_NUMBER_LEN];
char *fontstring;
char *filterstring;
+ char *savefilestring;
int signal_pipe[2]; /* pipe used to send messages from parent to child (currently only stop) */
#else
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, 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) {
argv = sync_pipe_add_arg(argv, &argc, "-s");
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);
}
+ /* 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 */
capture_opts->fork_child = spawnvp(_P_NOWAIT, ethereal_path, argv);
g_free(fontstring);
if (filterstring) {
g_free(filterstring);
}
+ if(savefilestring) {
+ g_free(savefilestring);
+ }
/* child own's the read side now, close our handle */
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);
}
+ 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) {
/*
* Child process - run Ethereal with the right arguments to make