From c2a14cf0dd0fa4b8af7d9198527518ced59e0a29 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 9 May 2011 15:26:08 +0200 Subject: [PATCH] hostnamed: check that nss-myhostname is installed --- TODO | 2 ++ src/hostnamed.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/TODO b/TODO index 643a111b..a26bcbcb 100644 --- a/TODO +++ b/TODO @@ -22,6 +22,8 @@ Features: * Make it possible to set the keymap independently from the font on the kernel cmdline. Right now setting one resets also the other. +* add dbus call to convert snapshot ino target + * make use of TIOCVHANGUP * move /selinux to /sys/fs/selinux diff --git a/src/hostnamed.c b/src/hostnamed.c index 91a82c82..ce690453 100644 --- a/src/hostnamed.c +++ b/src/hostnamed.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "util.h" #include "strv.h" @@ -110,6 +111,18 @@ static int read_data(void) { return 0; } +static bool check_nss(void) { + + void *dl; + + if ((dl = dlopen("libnss_myhostname.so.2", RTLD_LAZY))) { + dlclose(dl); + return true; + } + + return false; +} + static const char* fallback_icon_name(void) { #if defined(__i386__) || defined(__x86_64__) @@ -663,6 +676,9 @@ int main(int argc, char *argv[]) { goto finish; } + if (!check_nss()) + log_warning("Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!"); + umask(0022); r = read_data(); -- 2.39.5