Don't supply a fallback error message for pcap_open() unless it actually

fails.

This may clear up the problem most recently reported in bug 7021 after
the crash was fixed, where the capture starts successfully but an error
dialog pops up.

svn path=/trunk/; revision=43501
This commit is contained in:
Guy Harris 2012-06-27 05:13:06 +00:00
parent e3b8929a46
commit 2851255f53
1 changed files with 9 additions and 6 deletions

View File

@ -652,12 +652,15 @@ open_capture_device(interface_options *interface_opts,
(interface_opts->datatx_udp ? PCAP_OPENFLAG_DATATX_UDP : 0) |
(interface_opts->nocap_rpcap ? PCAP_OPENFLAG_NOCAPTURE_RPCAP : 0),
CAP_READ_TIMEOUT, &auth, *open_err_str);
if ((*open_err_str)[0] == '\0') {
/* Work around known WinPcap bug wherein no error message is
filled in on a failure to open an rpcap: URL. */
g_strlcpy(*open_err_str,
"Unknown error (pcap bug; actual error cause not reported)",
sizeof *open_err_str);
if (pcap_h == NULL) {
/* Error - did pcap actually supply an error message? */
if ((*open_err_str)[0] == '\0') {
/* Work around known WinPcap bug wherein no error message is
filled in on a failure to open an rpcap: URL. */
g_strlcpy(*open_err_str,
"Unknown error (pcap bug; actual error cause not reported)",
sizeof *open_err_str);
}
}
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
"pcap_open() returned %p.", (void *)pcap_h);