1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-28 02:50:16 +03:00

import,home: update $SYSTEMD_EXEC_PID= if it is set

The subsequent execv() or execl() always calls tools provided by
systemd. So, it is safe to update the variable.
This commit is contained in:
Yu Watanabe 2021-02-01 00:52:59 +09:00
parent 43f565c677
commit d754890843
2 changed files with 9 additions and 0 deletions

View File

@ -1038,6 +1038,10 @@ static int home_start_work(Home *h, const char *verb, UserRecord *hr, UserRecord
_exit(EXIT_FAILURE);
}
r = setenv_systemd_exec_pid(true);
if (r < 0)
log_warning_errno(r, "Failed to update $SYSTEMD_EXEC_PID, ignoring: %m");
r = rearrange_stdio(stdin_fd, stdout_fd, STDERR_FILENO);
if (r < 0) {
log_error_errno(r, "Failed to rearrange stdin/stdout/stderr: %m");

View File

@ -11,6 +11,7 @@
#include "bus-log-control-api.h"
#include "bus-polkit.h"
#include "def.h"
#include "env-util.h"
#include "fd-util.h"
#include "float.h"
#include "hostname-util.h"
@ -403,6 +404,10 @@ static int transfer_start(Transfer *t) {
_exit(EXIT_FAILURE);
}
r = setenv_systemd_exec_pid(true);
if (r < 0)
log_warning_errno(r, "Failed to update $SYSTEMD_EXEC_PID, ignoring: %m");
switch (t->type) {
case TRANSFER_IMPORT_TAR: