From b08ff80046482ccbb02725f2a74dcdf7a5cf6a54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 19 Jun 2018 12:22:31 -0400 Subject: [PATCH] Backport: relayd: Don't bypass the fd tracker when closing file descriptors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There is no reason to close all file descriptors at this point in the relay daemon as we know for a fact that the only open fds are stdin, stdout, and stderr. If the relayd was to depend on a library that opens other file descriptors, it would be unadvisable to perform this kind of bulk closing of all possible file descriptors. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-relayd/main.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index e22d58cf4..0d270d1ca 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -3300,23 +3300,12 @@ int main(int argc, char **argv) /* Daemonize */ if (opt_daemon || opt_background) { - int i; - ret = lttng_daemonize(&child_ppid, &recv_child_signal, !opt_background); if (ret < 0) { retval = -1; goto exit_options; } - - /* - * We are in the child. Make sure all other file - * descriptors are closed, in case we are called with - * more opened file descriptors than the standard ones. - */ - for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) { - (void) close(i); - } } if (opt_working_directory) { -- 2.34.1