Backport: relayd: track the quit pipe with the fd-tracker
[deliverable/lttng-tools.git] / src / bin / lttng-relayd / main.c
index e22d58cf443d344fff314329170f32828ab01f01..39bb32f1b0e198325c8213e04f782b1f6de118ad 100644 (file)
@@ -620,7 +620,7 @@ static void relayd_cleanup(void)
        free(opt_output_path);
 
        /* Close thread quit pipes */
-       utils_close_pipe(thread_quit_pipe);
+       (void) fd_tracker_util_pipe_close(the_fd_tracker, thread_quit_pipe);
 
        uri_free(control_uri);
        uri_free(data_uri);
@@ -783,11 +783,8 @@ void lttng_relay_notify_ready(void)
  */
 static int init_thread_quit_pipe(void)
 {
-       int ret;
-
-       ret = utils_create_pipe_cloexec(thread_quit_pipe);
-
-       return ret;
+       return fd_tracker_util_pipe_open_cloexec(the_fd_tracker,
+                       "Quit pipe", thread_quit_pipe);
 }
 
 /*
@@ -3300,23 +3297,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.025492 seconds and 5 git commands to generate.