summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2014-08-23 15:28:37 +0200
committerDaniel Mack <daniel@zonque.org>2014-09-05 12:18:57 +0200
commit9fa95f8539a380e93f760956bc6982e57f5bf3af (patch)
treef774c011d5563d2d381e91e1b50ac5c1e2e674e6 /src/core/socket.c
parenta4390b6be8869172ccdd16fef208803fc6c7a114 (diff)
exec: factor out most function arguments of exec_spawn() to ExecParameters
This way, the list of arguments to that function gets more comprehensive, and we can get around passing lots of NULL and 0 arguments from socket.c, swap.c and mount.c. It also allows for splitting up the code in exec_spawn(). While at it, make ExecContext const in execute.c.
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 7ca8edbda8..68e21e60ac 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1358,6 +1358,11 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
_cleanup_free_ char **argv = NULL;
pid_t pid;
int r;
+ ExecParameters exec_params = {
+ .apply_permissions = true,
+ .apply_chroot = true,
+ .apply_tty_stdin = true,
+ };
assert(s);
assert(c);
@@ -1377,21 +1382,17 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
if (r < 0)
goto fail;
+ exec_params.argv = argv;
+ exec_params.environment = UNIT(s)->manager->environment;
+ exec_params.confirm_spawn = UNIT(s)->manager->confirm_spawn;
+ exec_params.cgroup_supported = UNIT(s)->manager->cgroup_supported;
+ exec_params.cgroup_path = UNIT(s)->cgroup_path;
+ exec_params.runtime_prefix = manager_get_runtime_prefix(UNIT(s)->manager);
+ exec_params.unit_id = UNIT(s)->id;
+
r = exec_spawn(c,
- argv,
&s->exec_context,
- NULL, 0,
- UNIT(s)->manager->environment,
- true,
- true,
- true,
- UNIT(s)->manager->confirm_spawn,
- UNIT(s)->manager->cgroup_supported,
- UNIT(s)->cgroup_path,
- manager_get_runtime_prefix(UNIT(s)->manager),
- UNIT(s)->id,
- 0,
- NULL,
+ &exec_params,
s->exec_runtime,
&pid);
if (r < 0)