diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-06-27 05:13:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-06-27 05:13:06 +0000 |
commit | 2851255f539b670be6de47a3345bf1b25638cfc9 (patch) | |
tree | 4118188d85459a9303318f098c4a651143c49a34 | |
parent | e3b8929a469676e0b494a4d0d060ba8b223d07dd (diff) | |
download | wireshark-2851255f539b670be6de47a3345bf1b25638cfc9.tar.gz wireshark-2851255f539b670be6de47a3345bf1b25638cfc9.tar.bz2 wireshark-2851255f539b670be6de47a3345bf1b25638cfc9.zip |
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.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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); |