chiark / gitweb /
impot: minor cleanups
authorLennart Poettering <lennart@poettering.net>
Thu, 22 Jan 2015 02:51:22 +0000 (03:51 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 22 Jan 2015 03:02:07 +0000 (04:02 +0100)
src/import/import-dkr.c
src/import/import-tar.c
src/import/import-tar.h

index cebec28144f4851278baa5c1082af636847f588a..1a6cd4eaffc29d2767ee88618f84531ee3cf6a79 100644 (file)
@@ -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");
index e09ecaba115d612051791cf54ec1aad43c17ee9b..15482b48f0b18dca8910f7b05e0af5bfcd7c5cb0 100644 (file)
@@ -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;
-
 }
index 6a2b901d88dda16edcc0d755bbb29d78cb0d5846..212f804d16509917218e6beec457d335acbde3bf 100644 (file)
@@ -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);