diff options
author | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-05-25 17:46:04 +0000 |
---|---|---|
committer | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-05-25 17:46:04 +0000 |
commit | 753ed0217388e33ef0e9ff9c21d04039a1f54081 (patch) | |
tree | 1f12a54cda9e683fc244b6d3a97e212d78b1019c | |
parent | 3004ce3e889a10a092e819a66f8cc7764674ab97 (diff) |
fix #199: encapsulate capture filename, to avoid problems with spaces in the filename (win32 only)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14432 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | capture_sync.c | 21 |
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 |