diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-08-11 23:31:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-08-11 23:31:07 +0200 |
commit | afea26ad7d406d8b6c95d2642cb5a1d807b87546 (patch) | |
tree | c27bbf8effff5c5a956e0782cde9ff5a56e4b4c0 /src/util.c | |
parent | 444a79d34034aa8bfe60b92b0bb9e970803cbfb7 (diff) |
main: disable nscd properly, if possible
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index c4ff5aa575..c2ef34dd43 100644 --- a/src/util.c +++ b/src/util.c @@ -48,6 +48,7 @@ #include <pwd.h> #include <netinet/ip.h> #include <linux/kd.h> +#include <dlfcn.h> #include "macro.h" #include "util.h" @@ -2979,6 +2980,24 @@ char *ellipsize(const char *s, unsigned length, unsigned percent) { return r; } +void nss_disable_nscd(void) { + + void (*func)(void); + + /* This is an internal glibc function call. We are not + * supposed to call this, because we are not nscd. However + * sometimes we feel really dangerous and do it + * nonetheless. Muahahah! But at least we protect this with a + * dlsym() just in case glibc takes this away from us. */ + + if ((func = dlsym(RTLD_DEFAULT, "__nss_disable_nscd"))) { + log_debug("Disabling nscd."); + func(); + } else + log_debug("Cannot disable nscd."); +} + + static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", [IOPRIO_CLASS_RT] = "realtime", |