summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-daemon/sd-daemon.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-11-02 10:10:44 +0100
committerDaniel Mack <github@zonque.org>2015-11-02 10:10:44 +0100
commitd0744e54eb83a9f4e4f54a59de3905699a667be0 (patch)
tree67deec65f866186503d4a45c1197121625b159cb /src/libsystemd/sd-daemon/sd-daemon.c
parent534e8f89d6367cd0e9e17fff67880fb430071d01 (diff)
parent3958325852869a5e490b5741016c93b8b9a80e11 (diff)
Merge pull request #1745 from poettering/journal-deadlock
Make sure journald never blocks on sd_notify() to PID 1
Diffstat (limited to 'src/libsystemd/sd-daemon/sd-daemon.c')
-rw-r--r--src/libsystemd/sd-daemon/sd-daemon.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c
index 77b5dd52f6..27045e25d0 100644
--- a/src/libsystemd/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/sd-daemon/sd-daemon.c
@@ -44,6 +44,8 @@
#include "strv.h"
#include "util.h"
+#define SNDBUF_SIZE (8*1024*1024)
+
static void unsetenv_all(bool unset_environment) {
if (!unset_environment)
@@ -434,12 +436,19 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char
goto finish;
}
+ if (strlen(e) > sizeof(sockaddr.un.sun_path)) {
+ r = -EINVAL;
+ goto finish;
+ }
+
fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
r = -errno;
goto finish;
}
+ fd_inc_sndbuf(fd, SNDBUF_SIZE);
+
iovec.iov_len = strlen(state);
strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));