summaryrefslogtreecommitdiff
path: root/src/hostnamed.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-05-09 15:26:08 +0200
committerLennart Poettering <lennart@poettering.net>2011-05-17 17:19:45 +0200
commitc2a14cf0dd0fa4b8af7d9198527518ced59e0a29 (patch)
treeaee168031f66179d1ef33b6c89be1fe0c775d14b /src/hostnamed.c
parentfb389e05d891aa8f9ca67fa3f72119b5a827c800 (diff)
hostnamed: check that nss-myhostname is installed
Diffstat (limited to 'src/hostnamed.c')
-rw-r--r--src/hostnamed.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hostnamed.c b/src/hostnamed.c
index 91a82c8255..ce69045344 100644
--- a/src/hostnamed.c
+++ b/src/hostnamed.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <dlfcn.h>
#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();