aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2011-12-09 21:15:48 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2011-12-09 21:15:48 +0000
commit99947b8c90bf2bc0508057016270ba3a8a697333 (patch)
tree4e7fbd8b5ea8a55a1a5d2c92b52963eb6b4d65fd
parentf81f392b622c37cb9c274e1e2eb89f279d2c962c (diff)
Referring to pcap_version[] doesn't do what you want on at least some
UN*Xes (Fedora 16 and probably other Linux distributions, probably at least some if not all other ELF-based systems, and perhaps also Mac OS X), and causes problems if pcap_version[] has a different length in the libpcap with which the executable was built and the libpcap with which it's run, so we avoid using it for now. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40138 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--acinclude.m418
-rw-r--r--capture-pcap-util-unix.c26
2 files changed, 20 insertions, 24 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 2a6f6e28f4..7409bd7067 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -493,25 +493,7 @@ and did you also install that package?]]))
# libpcap.
#
ac_save_LIBS="$LIBS"
- AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
- AC_TRY_LINK(
- [
-# include <stdio.h>
- extern char *pcap_version;
- ],
- [
- printf ("%s\n", pcap_version);
- ],
- ac_cv_pcap_version_defined=yes,
- ac_cv_pcap_version_defined=no,
- [echo $ac_n "cross compiling; assumed OK... $ac_c"])
- if test "$ac_cv_pcap_version_defined" = yes ; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
- else
- AC_MSG_RESULT(no)
- fi
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
#
# pcap_breakloop may be present in the library but not declared
diff --git a/capture-pcap-util-unix.c b/capture-pcap-util-unix.c
index 6ea083cefd..a2bbd0ff78 100644
--- a/capture-pcap-util-unix.c
+++ b/capture-pcap-util-unix.c
@@ -333,13 +333,27 @@ cant_get_if_list_error_message(const char *err_str)
void
get_compiled_pcap_version(GString *str)
{
-#ifdef HAVE_PCAP_VERSION
- extern char pcap_version[];
-
- g_string_append_printf(str, "with libpcap %s", pcap_version);
-#else
+ /*
+ * NOTE: in *some* flavors of UN*X, the data from a shared
+ * library might be linked into executable images that are
+ * linked with that shared library, in which case you could
+ * look at pcap_version[] to get the version with which
+ * the program was compiled.
+ *
+ * In other flavors of UN*X, that doesn't happen, so
+ * pcap_version[] gives you the version the program is
+ * running with, not the version it was built with, and,
+ * in at least some of them, if the length of a data item
+ * referred to by the executable - such as the pcap_version[]
+ * string - isn't the same in the version of the library
+ * with which the program was built and the version with
+ * which it was run, the run-time linker will complain,
+ * which is Not Good.
+ *
+ * So, for now, we just give up on reporting the version
+ * of libpcap with which we were compiled.
+ */
g_string_append(str, "with libpcap (version unknown)");
-#endif
}
/*