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
This commit is contained in:
Bill Meier 2012-05-07 00:49:39 +00:00
parent 6edf8b716b
commit 9d4b7ad9fe
1 changed files with 22 additions and 19 deletions

View File

@ -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);