From 1b872b3648180aa042e36dd5b3ff38a03fa131e3 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 23 Apr 2003 08:20:06 +0000 Subject: 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 --- tap-mgcpstat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tap-mgcpstat.c') diff --git a/tap-mgcpstat.c b/tap-mgcpstat.c index 8313b7f42b..193b2d5135 100644 --- a/tap-mgcpstat.c +++ b/tap-mgcpstat.c @@ -1,7 +1,7 @@ /* tap-mgcpstat.c * mgcpstat 2003 Lars Roland * - * $Id: tap-mgcpstat.c,v 1.5 2003/04/23 03:50:59 guy Exp $ + * $Id: tap-mgcpstat.c,v 1.6 2003/04/23 08:20:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -186,7 +186,7 @@ mgcpstat_init(char *optarg) mgcpstat_t *ms; int i; char *filter=NULL; - + GString *error_string; if(!strncmp(optarg,"mgcp,rtd,",9)){ filter=optarg+9; @@ -216,12 +216,15 @@ mgcpstat_init(char *optarg) ms->req_dup_num=0; ms->rsp_dup_num=0; - if(register_tap_listener("mgcp", ms, filter, NULL, mgcpstat_packet, mgcpstat_draw)){ + error_string=register_tap_listener("mgcp", ms, filter, NULL, mgcpstat_packet, mgcpstat_draw); + if(error_string){ /* error, we failed to attach to the tap. clean up */ g_free(ms->filter); g_free(ms); - fprintf(stderr,"tethereal: mgcpstat_init() failed to attach to tap.\n"); + fprintf(stderr, "tethereal: Couldn't register mgcp,rtd tap: %s\n", + error_string->str); + g_string_free(error_string, TRUE); exit(1); } } -- cgit v1.2.3