]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Handle or voidify all calls to close_all_fds() 12015/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Mar 2019 14:35:49 +0000 (15:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Mar 2019 14:46:41 +0000 (15:46 +0100)
In activate, it is important that we close the fds. In other cases, meh.

src/activate/activate.c
src/basic/process-util.c
src/nspawn/nspawn-setuid.c
src/nspawn/nspawn-stub-pid1.c

index 7eae9e22c2858a52a388e57aa157001170e110b7..35ab08f22d85f2fd660d1d99391b1de232bacaee 100644 (file)
@@ -74,7 +74,9 @@ static int open_sockets(int *epoll_fd, bool accept) {
                         except[fd] = fd;
 
                 log_close();
-                close_all_fds(except, 3 + n);
+                r = close_all_fds(except, 3 + n);
+                if (r < 0)
+                        return log_error_errno(r, "Failed to close all file descriptors: %m");
         }
 
         /** Note: we leak some fd's on error here. I doesn't matter
index 86d5c3adb5e3633a835466e3bae322d02f88c391..c41a2aa5c9fd0bd9da432533978ba691e465b85c 100644 (file)
@@ -1001,7 +1001,7 @@ _noreturn_ void freeze(void) {
         log_close();
 
         /* Make sure nobody waits for us on a socket anymore */
-        close_all_fds(NULL, 0);
+        (void) close_all_fds(NULL, 0);
 
         sync();
 
index 0026e4e3fc7a7dfe94d0f4f629cc40256294be47..f207bcec04ebae3c93c62cfcab86cbadf0e06fc2 100644 (file)
@@ -43,7 +43,7 @@ static int spawn_getent(const char *database, const char *key, pid_t *rpid) {
                 if (rearrange_stdio(-1, pipe_fds[1], -1) < 0)
                         _exit(EXIT_FAILURE);
 
-                close_all_fds(NULL, 0);
+                (void) close_all_fds(NULL, 0);
 
                 (void) rlimit_nofile_safe();
 
index 5d17df39d9c2536ebc54e7dd7dc7172d20708be8..ebf4f0f523c989d64724967b68996d317ce9c92c 100644 (file)
@@ -67,7 +67,7 @@ int stub_pid1(sd_id128_t uuid) {
         reset_all_signal_handlers();
 
         log_close();
-        close_all_fds(NULL, 0);
+        (void) close_all_fds(NULL, 0);
         log_open();
 
         /* Flush out /proc/self/environ, so that we don't leak the environment from the host into the container. Also,