summaryrefslogtreecommitdiffstats
path: root/src/core/exec-invoke.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-07-11 11:44:31 +0200
committerLennart Poettering <lennart@poettering.net>2024-07-19 11:44:04 +0200
commit85f3957072071f0135f335d1631d2e2fc26e2659 (patch)
treef3d59564c0b04c02a40e8564f6e6d78e293c488c /src/core/exec-invoke.c
parentexec-invoke: save original stdin/stdout with O_CLOEXEC set (diff)
downloadsystemd-85f3957072071f0135f335d1631d2e2fc26e2659.tar.xz
systemd-85f3957072071f0135f335d1631d2e2fc26e2659.zip
exec-invoke: handle errno log message writing in write_confirm_error_fd() like we usually do
Diffstat (limited to '')
-rw-r--r--src/core/exec-invoke.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c
index 5a47c336c0..7d8270bc1c 100644
--- a/src/core/exec-invoke.c
+++ b/src/core/exec-invoke.c
@@ -694,15 +694,16 @@ static int setup_confirm_stdio(
}
static void write_confirm_error_fd(int err, int fd, const char *unit_id) {
- assert(err < 0);
+ assert(err != 0);
+ assert(fd >= 0);
assert(unit_id);
- if (err == -ETIMEDOUT)
+ errno = abs(err);
+
+ if (errno == ETIMEDOUT)
dprintf(fd, "Confirmation question timed out for %s, assuming positive response.\n", unit_id);
- else {
- errno = -err;
- dprintf(fd, "Couldn't ask confirmation for %s: %m, assuming positive response.\n", unit_id);
- }
+ else
+ dprintf(fd, "Couldn't ask confirmation for %s, assuming positive response: %m\n", unit_id);
}
static void write_confirm_error(int err, const char *vc, const char *unit_id) {