hostnamed: check that nss-myhostname is installed

This commit is contained in:
Lennart Poettering 2011-05-09 15:26:08 +02:00
parent fb389e05d8
commit c2a14cf0dd
2 changed files with 18 additions and 0 deletions

2
TODO
View file

@ -22,6 +22,8 @@ Features:
* Make it possible to set the keymap independently from the font on * Make it possible to set the keymap independently from the font on
the kernel cmdline. Right now setting one resets also the other. the kernel cmdline. Right now setting one resets also the other.
* add dbus call to convert snapshot ino target
* make use of TIOCVHANGUP * make use of TIOCVHANGUP
* move /selinux to /sys/fs/selinux * move /selinux to /sys/fs/selinux

View file

@ -24,6 +24,7 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <dlfcn.h>
#include "util.h" #include "util.h"
#include "strv.h" #include "strv.h"
@ -110,6 +111,18 @@ static int read_data(void) {
return 0; 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) { static const char* fallback_icon_name(void) {
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
@ -663,6 +676,9 @@ int main(int argc, char *argv[]) {
goto finish; 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); umask(0022);
r = read_data(); r = read_data();