summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAggelos Avgerinos <evaggelos.avgerinos@gmail.com>2017-05-09 01:09:22 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-05-09 01:09:22 +0200
commit488ab41cb89828e68162f34fb68241bbda700c05 (patch)
treecc378f4332b8087d0e3ce6061285987ec1acd363 /src
parentman: improve readability of time shorthands and their normalized forms. (#5912) (diff)
downloadsystemd-488ab41cb89828e68162f34fb68241bbda700c05.tar.xz
systemd-488ab41cb89828e68162f34fb68241bbda700c05.zip
execute: Properly log errors considering socket fds (#5910)
Till now if the params->n_fds was 0, systemd was logging that there were more than one sockets. Thanks @gregoryp and @VFXcode who did the most work debugging this.
Diffstat (limited to 'src')
-rw-r--r--src/core/execute.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 9c1aa4cf98..f6c4b4676e 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2927,11 +2927,16 @@ int exec_spawn(Unit *unit,
context->std_output == EXEC_OUTPUT_SOCKET ||
context->std_error == EXEC_OUTPUT_SOCKET) {
- if (params->n_fds != 1) {
+ if (params->n_fds > 1) {
log_unit_error(unit, "Got more than one socket.");
return -EINVAL;
}
+ if (params->n_fds == 0) {
+ log_unit_error(unit, "Got no socket.");
+ return -EINVAL;
+ }
+
socket_fd = params->fds[0];
} else {
socket_fd = -1;