Skip to content

Commit 7acf581

Browse files
committed
Handle or voidify all calls to close_all_fds()
In activate, it is important that we close the fds. In other cases, meh.
1 parent 054d871 commit 7acf581

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/activate/activate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ static int open_sockets(int *epoll_fd, bool accept) {
7474
except[fd] = fd;
7575

7676
log_close();
77-
close_all_fds(except, 3 + n);
77+
r = close_all_fds(except, 3 + n);
78+
if (r < 0)
79+
return log_error_errno(r, "Failed to close all file descriptors: %m");
7880
}
7981

8082
/** Note: we leak some fd's on error here. I doesn't matter

src/basic/process-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ _noreturn_ void freeze(void) {
10011001
log_close();
10021002

10031003
/* Make sure nobody waits for us on a socket anymore */
1004-
close_all_fds(NULL, 0);
1004+
(void) close_all_fds(NULL, 0);
10051005

10061006
sync();
10071007

src/nspawn/nspawn-setuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static int spawn_getent(const char *database, const char *key, pid_t *rpid) {
4343
if (rearrange_stdio(-1, pipe_fds[1], -1) < 0)
4444
_exit(EXIT_FAILURE);
4545

46-
close_all_fds(NULL, 0);
46+
(void) close_all_fds(NULL, 0);
4747

4848
(void) rlimit_nofile_safe();
4949

src/nspawn/nspawn-stub-pid1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int stub_pid1(sd_id128_t uuid) {
6767
reset_all_signal_handlers();
6868

6969
log_close();
70-
close_all_fds(NULL, 0);
70+
(void) close_all_fds(NULL, 0);
7171
log_open();
7272

7373
/* Flush out /proc/self/environ, so that we don't leak the environment from the host into the container. Also,

0 commit comments

Comments
 (0)