relayd: Don't bypass the fd tracker when closing file descriptors
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 26 Nov 2019 20:41:26 +0000 (15:41 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Jan 2020 06:55:34 +0000 (01:55 -0500)
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 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 <jeremie.galarneau@efficios.com>
Change-Id: I8ff134094b16dfb6c1aeb875431fdbd4f608eebd

src/bin/lttng-relayd/main.c

index f1f03d1bd36c90c7feefb9f417d5748f8cd10c4f..ed424d9dd0c9036768aeff6d29e4d2a146210308 100644 (file)
@@ -4042,23 +4042,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) {
This page took 0.026852 seconds and 4 git commands to generate.