summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-15 15:35:49 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-15 15:46:41 +0100
commit7acf581a58ba7d4efa65b86f5a94f00a993b16a8 (patch)
tree788f3995a8b1f495a49d1fb40f6e5328c541fb6a
parent054d871d41039fcfc1a4a661c979941b9660c9e6 (diff)
downloadsystemd-7acf581a58ba7d4efa65b86f5a94f00a993b16a8.tar.gz
systemd-7acf581a58ba7d4efa65b86f5a94f00a993b16a8.tar.bz2
systemd-7acf581a58ba7d4efa65b86f5a94f00a993b16a8.zip
Handle or voidify all calls to close_all_fds()
In activate, it is important that we close the fds. In other cases, meh.
-rw-r--r--src/activate/activate.c4
-rw-r--r--src/basic/process-util.c2
-rw-r--r--src/nspawn/nspawn-setuid.c2
-rw-r--r--src/nspawn/nspawn-stub-pid1.c2
4 files changed, 6 insertions, 4 deletions
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 7eae9e22c2..35ab08f22d 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -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
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 86d5c3adb5..c41a2aa5c9 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -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();
diff --git a/src/nspawn/nspawn-setuid.c b/src/nspawn/nspawn-setuid.c
index 0026e4e3fc..f207bcec04 100644
--- a/src/nspawn/nspawn-setuid.c
+++ b/src/nspawn/nspawn-setuid.c
@@ -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();
diff --git a/src/nspawn/nspawn-stub-pid1.c b/src/nspawn/nspawn-stub-pid1.c
index 5d17df39d9..ebf4f0f523 100644
--- a/src/nspawn/nspawn-stub-pid1.c
+++ b/src/nspawn/nspawn-stub-pid1.c
@@ -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,