aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-06-27 05:13:06 +0000
committerGuy Harris <guy@alum.mit.edu>2012-06-27 05:13:06 +0000
commit2851255f539b670be6de47a3345bf1b25638cfc9 (patch)
tree4118188d85459a9303318f098c4a651143c49a34
parente3b8929a469676e0b494a4d0d060ba8b223d07dd (diff)
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
-rw-r--r--dumpcap.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/dumpcap.c b/dumpcap.c
index e0be8a18fc..74f8811c13 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -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);