aboutsummaryrefslogtreecommitdiffstats
path: root/tap-iousers.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-iousers.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-iousers.c')
-rw-r--r--tap-iousers.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tap-iousers.c b/tap-iousers.c
index 95aeb7e541..7fdd50ae3e 100644
--- a/tap-iousers.c
+++ b/tap-iousers.c
@@ -1,7 +1,7 @@
/* tap-iousers.c
* iostat 2003 Ronnie Sahlberg
*
- * $Id: tap-iousers.c,v 1.5 2003/04/23 03:50:59 guy Exp $
+ * $Id: tap-iousers.c,v 1.6 2003/04/23 08:20:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -383,6 +383,7 @@ iousers_init(char *optarg)
char *tap_type;
static int (*packet_func)(io_users_t *, packet_info *, epan_dissect_t *, void *);
io_users_t *iu=NULL;
+ GString *error_string;
if(!strncmp(optarg,"io,users,eth",12)){
if(optarg[12]==','){
@@ -445,12 +446,15 @@ iousers_init(char *optarg)
iu->filter=NULL;
}
- if(register_tap_listener(tap_type, iu, filter, NULL, (void*)packet_func, (void*)iousers_draw)){
+ error_string=register_tap_listener(tap_type, iu, filter, NULL, (void*)packet_func, (void*)iousers_draw);
+ if(error_string){
if(iu->items){
g_free(iu->items);
}
g_free(iu);
- fprintf(stderr,"tethereal: iousers_init() failed to attach tap\n");
+ fprintf(stderr, "tethereal: Couldn't register io,users tap: %s\n",
+ error_string->str);
+ g_string_free(error_string, TRUE);
exit(1);
}