Undo the checking of command line interfaces. It might the a pipe...

svn path=/trunk/; revision=38146
This commit is contained in:
Michael Tüxen 2011-07-21 17:30:42 +00:00
parent 77022a66b0
commit f98587d686
2 changed files with 38 additions and 57 deletions

View File

@ -441,7 +441,6 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
int err;
gchar *err_str;
interface_options interface_opts;
gboolean found = FALSE;
/*
@ -452,21 +451,6 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
* names that begin with digits. It can be useful on Windows, where
* more than one interface can have the same name.
*/
if_list = capture_interface_list(&err, &err_str);
if (if_list == NULL) {
switch (err) {
case CANT_GET_INTERFACE_LIST:
cmdarg_err("%s", err_str);
g_free(err_str);
break;
case NO_INTERFACES_FOUND:
cmdarg_err("There are no interfaces on which a capture can be done");
break;
}
return 2;
}
adapter_index = strtol(optarg_str_p, &p, 10);
if (p != NULL && *p == '\0') {
if (adapter_index < 0) {
@ -482,34 +466,35 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
cmdarg_err("There is no interface with that adapter index");
return 1;
}
if_list = capture_interface_list(&err, &err_str);
if (if_list == NULL) {
switch (err) {
case CANT_GET_INTERFACE_LIST:
cmdarg_err("%s", err_str);
g_free(err_str);
break;
case NO_INTERFACES_FOUND:
cmdarg_err("There are no interfaces on which a capture can be done");
break;
}
return 2;
}
if_info = (if_info_t *)g_list_nth_data(if_list, adapter_index - 1);
if (if_info == NULL) {
cmdarg_err("There is no interface with that adapter index");
return 1;
}
found = TRUE;
interface_opts.name = g_strdup(if_info->name);
/* We don't set iface_descr here because doing so requires
* capture_ui_utils.c which requires epan/prefs.c which is
* probably a bit too much dependency for here...
*/
free_interface_list(if_list);
} else {
GList *curr;
for (curr = g_list_first(if_list); curr; curr = g_list_next(curr)) {
if_info = curr->data;
if (strcmp(if_info->name, optarg_str_p) == 0) {
found = TRUE;
break;
}
}
if (found) {
interface_opts.name = g_strdup(optarg_str_p);
}
}
free_interface_list(if_list);
if (found) {
interface_opts.descr = g_strdup(capture_opts->default_options.descr);
interface_opts.cfilter = g_strdup(capture_opts->default_options.cfilter);
interface_opts.snaplen = capture_opts->default_options.snaplen;
@ -537,10 +522,6 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
#endif
g_array_append_val(capture_opts->ifaces, interface_opts);
} else {
cmdarg_err("There is no interface with that name (%s)", optarg_str_p);
return 1;
}
return 0;
}

View File

@ -134,7 +134,7 @@ clopts_step_invalid_interface() {
if [ ! $RETURNVALUE -eq $EXIT_COMMAND_LINE ]; then
test_step_failed "exit status: $RETURNVALUE"
else
grep -i 'there is no interface with that name' ./testout.txt > /dev/null
grep -i 'The capture session could not be initiated' ./testout.txt > /dev/null
if [ $? -eq 0 ]; then
test_step_output_print ./testout.txt
test_step_ok