diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2021-03-05 04:09:47 +0000 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-03-06 12:56:11 +0000 |
commit | 41a172cc953382e4c830481dea14d895c622754e (patch) | |
tree | c5356ca4a2d622f621aefd5124e9ad3bd4cd6871 /dumpcap.c | |
parent | b5530e7021fa68c1d8e7e454b758cfea64acd6ba (diff) |
if_capabilities: Use a structured error msg from dumpcap
Have dumpcap in child mode return an error message with a primary and
secondary string, instead of using stderr. When writing to the console
log we ignore the second message to prevent flooding the log with
tutorial-like info on permissions.
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -5447,9 +5447,20 @@ main(int argc, char *argv[]) caps = get_if_capabilities(interface_opts, &err, &err_str); if (caps == NULL) { - cmdarg_err("The capabilities of the capture device \"%s\" could not be obtained (%s).\n" - "%s", interface_opts->name, err_str, - get_pcap_failure_secondary_error_message(err, err_str)); + if (capture_child) { + char *error_msg = g_strdup_printf("The capabilities of the capture device" + " \"%s\" could not be obtained (%s)", + interface_opts->name, err_str); + sync_pipe_errmsg_to_parent(2, error_msg, + get_pcap_failure_secondary_error_message(err, err_str)); + g_free(error_msg); + } + else { + cmdarg_err("The capabilities of the capture device" + "\"%s\" could not be obtained (%s).\n%s", + interface_opts->name, err_str, + get_pcap_failure_secondary_error_message(err, err_str)); + } g_free(err_str); exit_main(2); } |