diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-07 23:07:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-08 12:55:15 +0200 |
commit | a34ceba66fc0e856d8f76f340389a4768b57a365 (patch) | |
tree | b34ee4cf6eda0d1fef3df2235c58252b96958c69 /src/core/busname.c | |
parent | 66cb2fde7b0ab6603775ad13c30c004f5fd88f0c (diff) |
core: add support for setting stdin/stdout/stderr for transient services
When starting a transient service, allow setting stdin/stdout/stderr fds
for it, by passing them in via the bus.
This also simplifies some of the serialization code for units.
Diffstat (limited to 'src/core/busname.c')
-rw-r--r-- | src/core/busname.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/core/busname.c b/src/core/busname.c index ba353ab660..38becfc119 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -656,6 +656,7 @@ static int busname_stop(Unit *u) { static int busname_serialize(Unit *u, FILE *f, FDSet *fds) { BusName *n = BUSNAME(u); + int r; assert(n); assert(f); @@ -667,15 +668,9 @@ static int busname_serialize(Unit *u, FILE *f, FDSet *fds) { if (n->control_pid > 0) unit_serialize_item_format(u, f, "control-pid", PID_FMT, n->control_pid); - if (n->starter_fd >= 0) { - int copy; - - copy = fdset_put_dup(fds, n->starter_fd); - if (copy < 0) - return copy; - - unit_serialize_item_format(u, f, "starter-fd", "%i", copy); - } + r = unit_serialize_item_fd(u, f, fds, "starter-fd", n->starter_fd); + if (r < 0) + return r; return 0; } |