diff options
author | Dan Winship <danw@gnome.org> | 2014-07-25 17:50:14 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-07-31 14:58:15 -0400 |
commit | 80715291ca183a72f5602a6a1a42535cce327677 (patch) | |
tree | 403eff410e9a076ab195a9504b2ed7da98147c6a /libnm-util/nm-utils.c | |
parent | 51a2cd2882133e20c4a894127b685ea18c5fe1d9 (diff) | |
download | NetworkManager-danw/libnm-initial.tar.gz |
libnm, libnm-utils: error out if mixed libnm/libnm-util symbols are detecteddanw/libnm-initial
If a program accidentally ends up linking in both libnm and libnm-util
(presumably via different dependencies), error out immediately.
Diffstat (limited to 'libnm-util/nm-utils.c')
-rw-r--r-- | libnm-util/nm-utils.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 9c96601c90..a5113538dd 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -26,6 +26,7 @@ #include <netinet/ether.h> #include <linux/if_infiniband.h> #include <uuid/uuid.h> +#include <gmodule.h> #include "nm-utils.h" #include "nm-utils-private.h" @@ -202,6 +203,18 @@ get_encodings_for_lang (const char *lang, /* init, deinit for libnm_util */ +static void __attribute__((constructor)) +_check_symbols (void) +{ + GModule *self; + gpointer func; + + self = g_module_open (NULL, 0); + if (g_module_symbol (self, "nm_device_state_get_type", &func)) + g_error ("libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported"); + g_module_close (self); +} + static gboolean initialized = FALSE; /** |