path: root/capture-pcap-util-unix.c
diff options
authorGuy Harris <guy@alum.mit.edu>2011-12-09 21:15:48 +0000
committerGuy Harris <guy@alum.mit.edu>2011-12-09 21:15:48 +0000
commite42d0d35d85caf1ecb86c4655adee608599ac5d7 (patch)
tree4e7fbd8b5ea8a55a1a5d2c92b52963eb6b4d65fd /capture-pcap-util-unix.c
parentf70480894c5617ac92ba2f408228b14b4dbdbcf4 (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. svn path=/trunk/; revision=40138
Diffstat (limited to 'capture-pcap-util-unix.c')
1 files changed, 20 insertions, 6 deletions
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)
get_compiled_pcap_version(GString *str)
- extern char pcap_version[];
- g_string_append_printf(str, "with libpcap %s", pcap_version);
+ /*
+ * 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)");