summaryrefslogtreecommitdiff
path: root/src/import/import-tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/import/import-tar.c')
-rw-r--r--src/import/import-tar.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index e09ecaba11..15482b48f0 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -292,7 +292,7 @@ static int tar_import_job_on_open_disk(ImportJob *j) {
}
if (pipefd[0] != STDIN_FILENO)
- safe_close(pipefd[0]);
+ pipefd[0] = safe_close(pipefd[0]);
null_fd = open("/dev/null", O_WRONLY|O_NOCTTY);
if (null_fd < 0) {
@@ -306,7 +306,11 @@ static int tar_import_job_on_open_disk(ImportJob *j) {
}
if (null_fd != STDOUT_FILENO)
- safe_close(null_fd);
+ null_fd = safe_close(null_fd);
+
+ fd_cloexec(STDIN_FILENO, false);
+ fd_cloexec(STDOUT_FILENO, false);
+ fd_cloexec(STDERR_FILENO, false);
execlp("tar", "tar", "--numeric-owner", "-C", i->temp_path, "-px", NULL);
log_error_errno(errno, "Failed to execute tar: %m");
@@ -374,5 +378,4 @@ int tar_import_pull(TarImport *i, const char *url, const char *local, bool force
}
return 0;
-
}