]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/import/importd.c
importd: check setenv return value
[thirdparty/systemd.git] / src / import / importd.c
index 9d31a956a548e0362b644b822ae65e488c5827a3..3d379d6de9ea3de2a5015f3784b37e403996ab1c 100644 (file)
@@ -449,8 +449,11 @@ static int transfer_start(Transfer *t) {
 
                 stdio_unset_cloexec();
 
-                setenv("SYSTEMD_LOG_TARGET", "console-prefixed", 1);
-                setenv("NOTIFY_SOCKET", "/run/systemd/import/notify", 1);
+                if (setenv("SYSTEMD_LOG_TARGET", "console-prefixed", 1) < 0 ||
+                    setenv("NOTIFY_SOCKET", "/run/systemd/import/notify", 1) < 0) {
+                        log_error_errno(errno, "setenv() failed: %m");
+                        _exit(EXIT_FAILURE);
+                }
 
                 if (IN_SET(t->type, TRANSFER_IMPORT_TAR, TRANSFER_IMPORT_RAW))
                         cmd[k++] = SYSTEMD_IMPORT_PATH;