diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-08-26 18:36:09 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-08-26 18:36:09 +0000 |
commit | a28b428afffadcca07a575306c68a3710a306610 (patch) | |
tree | 66a666f308ad70da58187b19ba600bb34cd0b55c /tshark.c | |
parent | 14be5e2bcc15c3c9d6717c12f395d820eb57c176 (diff) | |
download | wireshark-a28b428afffadcca07a575306c68a3710a306610.tar.gz wireshark-a28b428afffadcca07a575306c68a3710a306610.tar.bz2 wireshark-a28b428afffadcca07a575306c68a3710a306610.zip |
Go back to setting the capture filter to an empty string when we start;
that obviates the need to check for a null capture filter string, and
fixes bug 1055.
Keep track of whether it was set from the command line, though, so we
can catch attempts to set the filter more than once, and attempts to set
it when we're not capturing.
Clean up white space.
svn path=/trunk/; revision=19047
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -1103,11 +1103,12 @@ main(int argc, char *argv[]) rfilter = get_args_as_string(argc, argv, optind); } else { #ifdef HAVE_LIBPCAP - if (capture_opts.cfilter != NULL) { + if (capture_opts.has_cfilter) { cmdarg_err("Capture filters were specified both with \"-f\"" " and with additional command-line arguments"); exit(1); } + capture_opts.has_cfilter = TRUE; capture_opts.cfilter = get_args_as_string(argc, argv, optind); #else capture_option_specified = TRUE; @@ -1147,7 +1148,7 @@ main(int argc, char *argv[]) support in capture files we read). */ #ifdef HAVE_LIBPCAP if (cf_name != NULL) { - if (capture_opts.cfilter != NULL) { + if (capture_opts.has_cfilter) { cmdarg_err("Only read filters, not capture filters, " "can be specified when reading a capture file."); exit(1); @@ -1561,14 +1562,6 @@ capture(void) */ relinquish_special_privs_perm(); - /* - * Some older Linux versions of libpcap don't work right without - * a capture filter; if none was specified, use an empty string. - * (Yes, that's a libpcap bug, and has been fixed for a while.) - */ - if (capture_opts.cfilter == NULL) - capture_opts.cfilter = g_strdup(""); - /* 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)) { |