diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-03-05 04:11:57 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-03-05 04:11:57 +0000 |
commit | 892078df8e78c7bf235cdb0c8efb32b986012263 (patch) | |
tree | aee8d597f92ec39e875157ee0f7dd7f7da739b0e /tethereal.c | |
parent | 3fe140439fd99b4b08391e9c476583effb79f6ac (diff) |
In the capture_loop.c code, open the capture device for input before
doing anything with the output file, so that
1) if the attempt to open the capture device fails, we don't
bother creating any output files;
2) we could relinquish privileges permanently as soon as we
finish opening the capture device, so we don't have to give
them up temporarily when opening the output file, reclaim
them to open the input device, and then give them up
permanently;
(we already do that in Tethereal).
While we're at it, set the capture filter immediately after opening the
capture device, so we quit before opening capture devices if that fails.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17468 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tethereal.c b/tethereal.c index 176607996b..30176210d9 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1548,12 +1548,6 @@ capture(void) */ relinquish_special_privs_perm(); - /* open the output file (temporary/specified name/ringbuffer/named pipe/stdout) */ - if (!capture_loop_open_output(&capture_opts, &save_file_fd, errmsg, sizeof(errmsg))) { - *secondary_errmsg = '\0'; - goto error; - } - /* init the input filter from the network interface (capture pipe will do nothing) */ switch (capture_loop_init_filter(ld.pcap_h, ld.from_cap_pipe, capture_opts.iface, capture_opts.cfilter)) { @@ -1573,6 +1567,12 @@ capture(void) goto error; } + /* open the output file (temporary/specified name/ringbuffer/named pipe/stdout) */ + if (!capture_loop_open_output(&capture_opts, &save_file_fd, errmsg, sizeof(errmsg))) { + *secondary_errmsg = '\0'; + goto error; + } + /* set up to write to the already-opened capture output file/files */ if(!capture_loop_init_output(&capture_opts, save_file_fd, &ld, errmsg, sizeof errmsg)) { *secondary_errmsg = '\0'; |