diff options
author | Dave Reisner <dreisner@archlinux.org> | 2014-02-21 16:31:26 +0100 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2014-02-21 18:49:05 +0100 |
commit | 28def94cc8fd4394b20e2155d7130166662343c4 (patch) | |
tree | c734d99cbeace21ad0d62d470b5a603026fec105 /src | |
parent | ptyfwd: reset nonblocking mode (diff) | |
download | systemd-28def94cc8fd4394b20e2155d7130166662343c4.tar.xz systemd-28def94cc8fd4394b20e2155d7130166662343c4.zip |
journald: ignore failure to watch hostname_fd on older kernels
Prior to 3.2, /proc/sys/kernel/hostname isn't a pollable file and
sd_event_add_io will return EPERM. Ignore this failure, since it isn't
critical to journald operation.
Reported and tested by user sraue on IRC.
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journald-server.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 5872e91fba..96ef66db5f 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1430,6 +1430,16 @@ static int server_open_hostname(Server *s) { r = sd_event_add_io(s->event, &s->hostname_event_source, s->hostname_fd, 0, dispatch_hostname_change, s); if (r < 0) { + /* kernels prior to 3.2 don't support polling this file. Ignore + * the failure. */ + if (r == -EPERM) { + log_warning("Failed to register hostname fd in event loop: %s. Ignoring.", + strerror(-r)); + close_nointr_nofail(s->hostname_fd); + s->hostname_fd = -1; + return 0; + } + log_error("Failed to register hostname fd in event loop: %s", strerror(-r)); return r; } |