If -z was not given as the very last argument the tap listener initialization might have crashed.

Copy the optarg so that when the tap initialization is called it gets the right argument.

svn path=/trunk/; revision=13570
This commit is contained in:
Luis Ontanon 2005-03-01 23:46:05 +00:00
parent 95c0c2831d
commit 779a8f5d80
1 changed files with 6 additions and 4 deletions

View File

@ -682,7 +682,7 @@ main(int argc, char *argv[])
e_prefs *prefs;
char badopt;
ethereal_tap_list *tli = NULL;
gboolean got_tap = FALSE;
guint8* tli_optarg = NULL;
#ifdef HAVE_LIBPCAP
capture_opts_init(&capture_opts, NULL /* cfile */);
@ -1050,7 +1050,7 @@ main(int argc, char *argv[])
as it would disallow mate's fields (which are registered
by the preferences set callback) from being used as
part of a tap filter */
got_tap = TRUE;
tli_optarg = g_strdup(optarg);
break;
}
}
@ -1240,8 +1240,10 @@ main(int argc, char *argv[])
/* At this point mate will have registered its field array so we can
have a filter with one of mate's late registered fields as part
of the tap's filter */
if (got_tap)
(*tli->func)(optarg);
if (tli_optarg != NULL) {
(*tli->func)(tli_optarg);
g_free(tli_optarg);
}
/* disabled protocols as per configuration file */
if (gdp_path == NULL && dp_path == NULL) {