diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-25 00:30:32 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-12 13:43:30 +0200 |
commit | 92dd7c49659a0bb4c8e081199e4ff4351f37397a (patch) | |
tree | 3754290b73d4718a3f25b7042302bc8fb6f2d3f6 /src/core/manager.c | |
parent | e4bb56c7a946190c348a3c686af6cb35661fa5fe (diff) |
core: reuse manager_get_runtime_prefix() at more places
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index b3c3445f2c..c72b46be30 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -676,6 +676,7 @@ static int manager_setup_notify(Manager *m) { .sa.sa_family = AF_UNIX, }; static const int one = 1; + const char *e; /* First free all secondary fields */ m->notify_socket = mfree(m->notify_socket); @@ -687,19 +688,13 @@ static int manager_setup_notify(Manager *m) { fd_inc_rcvbuf(fd, NOTIFY_RCVBUF_SIZE); - if (MANAGER_IS_SYSTEM(m)) - m->notify_socket = strdup("/run/systemd/notify"); - else { - const char *e; - - e = getenv("XDG_RUNTIME_DIR"); - if (!e) { - log_error_errno(errno, "XDG_RUNTIME_DIR is not set: %m"); - return -EINVAL; - } - - m->notify_socket = strappend(e, "/systemd/notify"); + e = manager_get_runtime_prefix(m); + if (!e) { + log_error("Failed to determine runtime prefix."); + return -EINVAL; } + + m->notify_socket = strappend(e, "/systemd/notify"); if (!m->notify_socket) return log_oom(); |