aboutsummaryrefslogtreecommitdiffstats
path: root/tap-iousers.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2003-04-23 08:20:06 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2003-04-23 08:20:06 +0000
commitba91fe1919e92b5e7202e10d8ab53dbd783eaecf (patch)
tree04f0fba9423fc1a57c5f559ee0a5fc49138ddb6e /tap-iousers.c
parentd7d2a95b9a62c2055b4906a51a0c824d9c9d3f93 (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". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7542 f5534014-38df-0310-8fa8-9805f1628bb7
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);
}