summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-09-25 12:02:26 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:26 +0100
commitff391acf2c61fec39a5260ad9b279d810ee78bc0 (patch)
treefd1eab188bed122984c6a0da4828eea81be5177b
parente592905014cbab2ea95b762bdc8604bae16b32c0 (diff)
exec-util: handle putenv() errors
Just paranoia, as putenv() can fail and we should catch it, like we catch all other errors. Follow-up for #10073 (cherry picked from commit ed689f7894e56024a11bd02327b2bdfce5636dfd)
-rw-r--r--src/basic/exec-util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/basic/exec-util.c b/src/basic/exec-util.c
index cfb082a03..468c247c6 100644
--- a/src/basic/exec-util.c
+++ b/src/basic/exec-util.c
@@ -102,7 +102,8 @@ static int do_execute(
alarm(DIV_ROUND_UP(timeout, USEC_PER_SEC));
STRV_FOREACH(e, envp)
- putenv(*e);
+ if (putenv(*e) < 0)
+ return log_error_errno(errno, "Failed to set environment variable: %m");
STRV_FOREACH(path, paths) {
_cleanup_free_ char *t = NULL;