summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-22 03:51:22 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-22 04:02:07 +0100
commitf4c135bf2f0abcf79c89efbeae51f03bacba5f2f (patch)
tree5bfb25be01f56750a8eedc39166919ef1a2831f3 /src
parentaca83a53ee1dd01beafcd07c55c4cd6c3efb4224 (diff)
impot: minor cleanups
Diffstat (limited to 'src')
-rw-r--r--src/import/import-dkr.c8
-rw-r--r--src/import/import-tar.c9
-rw-r--r--src/import/import-tar.h2
3 files changed, 13 insertions, 6 deletions
diff --git a/src/import/import-dkr.c b/src/import/import-dkr.c
index cebec28144..1a6cd4eaff 100644
--- a/src/import/import-dkr.c
+++ b/src/import/import-dkr.c
@@ -454,7 +454,7 @@ static int dkr_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) {
@@ -468,7 +468,11 @@ static int dkr_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");
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;
-
}
diff --git a/src/import/import-tar.h b/src/import/import-tar.h
index 6a2b901d88..212f804d16 100644
--- a/src/import/import-tar.h
+++ b/src/import/import-tar.h
@@ -34,4 +34,4 @@ TarImport* tar_import_unref(TarImport *import);
DEFINE_TRIVIAL_CLEANUP_FUNC(TarImport*, tar_import_unref);
-int tar_import_pull(TarImport *import, const char *rul, const char *local, bool force_local, ImportVerify verify);
+int tar_import_pull(TarImport *import, const char *url, const char *local, bool force_local, ImportVerify verify);