From 6f856a0992aee3fb06cb13a761b902657ff228ea Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 11 May 2015 20:13:37 +0200 Subject: core: always initialize ExecParamters.bus_endpoint_fd to -1 Otherwise it might be passed in as 0, which is a valid fd, but usually does not refer to a real endpoint. --- src/core/mount.c | 1 + src/core/service.c | 8 ++++---- src/core/socket.c | 1 + src/core/swap.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/mount.c b/src/core/mount.c index 65a66b468f..5a1547728b 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -694,6 +694,7 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) { .apply_permissions = true, .apply_chroot = true, .apply_tty_stdin = true, + .bus_endpoint_fd = -1, }; assert(m); diff --git a/src/core/service.c b/src/core/service.c index d52ba73aac..1c55e53c3c 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1054,10 +1054,10 @@ static int service_spawn( **argv = NULL, **final_env = NULL, **our_env = NULL; const char *path; ExecParameters exec_params = { - .apply_permissions = apply_permissions, - .apply_chroot = apply_chroot, - .apply_tty_stdin = apply_tty_stdin, - .bus_endpoint_fd = -1, + .apply_permissions = apply_permissions, + .apply_chroot = apply_chroot, + .apply_tty_stdin = apply_tty_stdin, + .bus_endpoint_fd = -1, .selinux_context_net = s->socket_fd_selinux_context_net }; diff --git a/src/core/socket.c b/src/core/socket.c index 55334e4a54..3fb3b362e1 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1398,6 +1398,7 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) { .apply_permissions = true, .apply_chroot = true, .apply_tty_stdin = true, + .bus_endpoint_fd = -1, }; assert(s); diff --git a/src/core/swap.c b/src/core/swap.c index 5f98f0b98b..0d04bb4de8 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -607,6 +607,7 @@ static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) { .apply_permissions = true, .apply_chroot = true, .apply_tty_stdin = true, + .bus_endpoint_fd = -1, }; assert(s); -- cgit v1.2.3-54-g00ecf