From e42d0d35d85caf1ecb86c4655adee608599ac5d7 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 9 Dec 2011 21:15:48 +0000 Subject: 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 --- capture-pcap-util-unix.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'capture-pcap-util-unix.c') 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 } /* -- cgit v1.2.3