aboutsummaryrefslogtreecommitdiffstats
path: root/tap-smbstat.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-04-23 08:20:06 +0000
committerGuy Harris <guy@alum.mit.edu>2003-04-23 08:20:06 +0000
commit1b872b3648180aa042e36dd5b3ff38a03fa131e3 (patch)
tree04f0fba9423fc1a57c5f559ee0a5fc49138ddb6e /tap-smbstat.c
parent81ebec370d30901623ef24b2112e91f8004c6ad0 (diff)
Make "register_tap_listener()" return NULL on success and a "GString *"
referring to a GString containing an error message on failure, and don't have it print anything on failure. If it fails, have its Tethereal-tap callers print an error message before exiting, and have its Ethereal callers pop up a dialog box with the error (except in cases where the failure is guaranteed not to be the user's fault, and where we exit, in which case we just print an error message before we exit). In all cases, the error message includes the text of the GString. Fix a scanf format string in the DCE RPC statistics Ethereal tap, so that it properly skips the comma before the filter string. Fix some Ethereal error messages not to say "tethereal". svn path=/trunk/; revision=7542
Diffstat (limited to 'tap-smbstat.c')
-rw-r--r--tap-smbstat.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tap-smbstat.c b/tap-smbstat.c
index 7683ac3a3f..cb42739494 100644
--- a/tap-smbstat.c
+++ b/tap-smbstat.c
@@ -1,7 +1,7 @@
/* tap-smbstat.c
* smbstat 2003 Ronnie Sahlberg
*
- * $Id: tap-smbstat.c,v 1.2 2003/04/23 03:50:59 guy Exp $
+ * $Id: tap-smbstat.c,v 1.3 2003/04/23 08:20:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -247,7 +247,7 @@ smbstat_init(char *optarg)
smbstat_t *ss;
guint32 i;
char *filter=NULL;
-
+ GString *error_string;
if(!strncmp(optarg,"smb,rtt,",8)){
filter=optarg+8;
@@ -281,12 +281,15 @@ smbstat_init(char *optarg)
ss->trans2[i].tot.nsecs=0;
}
- if(register_tap_listener("smb", ss, filter, NULL, smbstat_packet, smbstat_draw)){
+ error_string=register_tap_listener("smb", ss, filter, NULL, smbstat_packet, smbstat_draw);
+ if(error_string){
/* error, we failed to attach to the tap. clean up */
g_free(ss->filter);
g_free(ss);
- fprintf(stderr,"tethereal: smbstat_init() failed to attach to tap.\n");
+ fprintf(stderr, "tethereal: Couldn't register smb,rtt tap: %s\n",
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}
}