diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-05-07 00:49:39 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-05-07 00:49:39 +0000 |
commit | 9d4b7ad9fefc921a73acdbe2f9cac8c9a540d439 (patch) | |
tree | 08b43cc518e48e2d18eb066edfdca923b6a87bb5 /dumpcap.c | |
parent | 6edf8b716bfb388ac10f96779450b7b9aa826140 (diff) | |
download | wireshark-9d4b7ad9fefc921a73acdbe2f9cac8c9a540d439.tar.gz wireshark-9d4b7ad9fefc921a73acdbe2f9cac8c9a540d439.tar.bz2 wireshark-9d4b7ad9fefc921a73acdbe2f9cac8c9a540d439.zip |
From Evan Huus:
In get_capture_device_open_failure_messages() in dumpcap.c, there are some
statements that should have been guarded by ifdefs, causing a little
unnecessary work on some platforms, and a bunch of unused-variable warnings
from static analyzers. The patch fixes the problem.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7228
svn path=/trunk/; revision=42454
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 41 |
1 files changed, 22 insertions, 19 deletions
@@ -717,28 +717,11 @@ get_capture_device_open_failure_messages(const char *open_err_str, char *secondary_errmsg, size_t secondary_errmsg_len) { +#ifndef _WIN32 const char *libpcap_warn; static const char ppamsg[] = "can't find PPA for "; +#endif - /* If we got a "can't find PPA for X" message, warn the user (who - is running dumpcap on HP-UX) that they don't have a version of - libpcap that properly handles HP-UX (libpcap 0.6.x and later - versions, which properly handle HP-UX, say "can't find /dev/dlpi - PPA for X" rather than "can't find PPA for X"). */ - if (strncmp(open_err_str, ppamsg, sizeof ppamsg - 1) == 0) - libpcap_warn = - "\n\n" - "You are running (T)Wireshark with a version of the libpcap library\n" - "that doesn't handle HP-UX network devices well; this means that\n" - "(T)Wireshark may not be able to capture packets.\n" - "\n" - "To fix this, you should install libpcap 0.6.2, or a later version\n" - "of libpcap, rather than libpcap 0.4 or 0.5.x. It is available in\n" - "packaged binary form from the Software Porting And Archive Centre\n" - "for HP-UX; the Centre is at http://hpux.connect.org.uk/ - the page\n" - "at the URL lists a number of mirror sites."; - else - libpcap_warn = ""; g_snprintf(errmsg, (gulong) errmsg_len, "The capture session could not be initiated (%s).", open_err_str); #ifdef _WIN32 @@ -772,6 +755,26 @@ get_capture_device_open_failure_messages(const char *open_err_str, iface); } #else + /* If we got a "can't find PPA for X" message, warn the user (who + is running dumpcap on HP-UX) that they don't have a version of + libpcap that properly handles HP-UX (libpcap 0.6.x and later + versions, which properly handle HP-UX, say "can't find /dev/dlpi + PPA for X" rather than "can't find PPA for X"). */ + if (strncmp(open_err_str, ppamsg, sizeof ppamsg - 1) == 0) + libpcap_warn = + "\n\n" + "You are running (T)Wireshark with a version of the libpcap library\n" + "that doesn't handle HP-UX network devices well; this means that\n" + "(T)Wireshark may not be able to capture packets.\n" + "\n" + "To fix this, you should install libpcap 0.6.2, or a later version\n" + "of libpcap, rather than libpcap 0.4 or 0.5.x. It is available in\n" + "packaged binary form from the Software Porting And Archive Centre\n" + "for HP-UX; the Centre is at http://hpux.connect.org.uk/ - the page\n" + "at the URL lists a number of mirror sites."; + else + libpcap_warn = ""; + g_snprintf(secondary_errmsg, (gulong) secondary_errmsg_len, "Please check to make sure you have sufficient permissions, and that you have " "the proper interface or pipe specified.%s", libpcap_warn); |