aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/capture_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-01-06 05:09:01 +0000
committerGuy Harris <guy@alum.mit.edu>2000-01-06 05:09:01 +0000
commit9607209dccc166f2d918207c5b2c9731824e618e (patch)
tree8ab7aeb6a62a61fe599fcefdb78c565389f6236a /gtk/capture_dlg.c
parent5b8384f5e11fe3a6f7873f7d06e0f7e7e7ac0a3a (diff)
downloadwireshark-9607209dccc166f2d918207c5b2c9731824e618e.tar.gz
wireshark-9607209dccc166f2d918207c5b2c9731824e618e.tar.bz2
wireshark-9607209dccc166f2d918207c5b2c9731824e618e.zip
Don't bother checking whether the filter string is empty - just use it
even if it's empty, rather than using an empty string instead of it if it's empty. Also, "gtk_entry_get_text()" appears, from the documentation, always to return a non-null pointer (and it returned a non-null pointer when I started a capture with an empty filter string); don't supply a null string if it's null, just do a "g_assert()" to make sure it's non-null. Put in a comment explaining why we aren't trying to be clever and detecting an empty filter string and setting "cf.filter" to NULL if it's empty. svn path=/trunk/; revision=1423
Diffstat (limited to 'gtk/capture_dlg.c')
-rw-r--r--gtk/capture_dlg.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index 20d65a21f9..f69605de0c 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -1,7 +1,7 @@
/* capture_dlg.c
* Routines for packet capture windows
*
- * $Id: capture_dlg.c,v 1.15 2000/01/05 22:31:45 gerald Exp $
+ * $Id: capture_dlg.c,v 1.16 2000/01/06 05:09:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -342,14 +342,19 @@ capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) {
cf.iface = g_strdup(if_name);
g_free(if_text);
+ /* XXX - don't try to get clever and set "cf.filter" to NULL if the
+ filter string is empty, as an indication that we don't have a filter
+ and thus don't have to set a filter when capturing - the version of
+ libpcap in Red Hat Linux 6.1, and versions based on later patches
+ in that series, don't bind the AF_PACKET socket to an interface
+ until a filter is set, which means they aren't bound at all if
+ no filter is set, which means no packets arrive as input on that
+ socket, which means Ethereal never sees any packets. */
filter_text = gtk_entry_get_text(GTK_ENTRY(filter_te));
if (cf.cfilter)
g_free(cf.cfilter);
- if (filter_text && filter_text[0]) {
- cf.cfilter = g_strdup(filter_text);
- } else {
- cf.cfilter = g_strdup(EMPTY_FILTER);
- }
+ g_assert(filter_text != NULL);
+ cf.cfilter = g_strdup(filter_text);
save_file = gtk_entry_get_text(GTK_ENTRY(file_te));
if (save_file && save_file[0]) {