]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: add some DEBUG() logging to stdfd dpulication 3637/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 27 Jan 2021 19:55:02 +0000 (20:55 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 27 Jan 2021 19:55:02 +0000 (20:55 +0100)
Cc: stable-4.0
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index c5669128c1394434d302b5c8626af5fc47e33177..df82cd28d7457b451a5b3d3c856c108345264fff 100644 (file)
@@ -831,13 +831,16 @@ __noreturn static void do_attach(struct attach_clone_payload *payload)
         * may want to make sure the fds are closed, for example.
         */
        if (options->stdin_fd >= 0 && options->stdin_fd != STDIN_FILENO)
-               (void)dup2(options->stdin_fd, STDIN_FILENO);
+               if (dup2(options->stdin_fd, STDIN_FILENO))
+                       DEBUG("Failed to replace stdin with %d", options->stdin_fd);
 
        if (options->stdout_fd >= 0 && options->stdout_fd != STDOUT_FILENO)
-               (void)dup2(options->stdout_fd, STDOUT_FILENO);
+               if (dup2(options->stdout_fd, STDOUT_FILENO))
+                       DEBUG("Failed to replace stdout with %d", options->stdin_fd);
 
        if (options->stderr_fd >= 0 && options->stderr_fd != STDERR_FILENO)
-               (void)dup2(options->stderr_fd, STDERR_FILENO);
+               if (dup2(options->stderr_fd, STDERR_FILENO))
+                       DEBUG("Failed to replace stderr with %d", options->stdin_fd);
 
        /* close the old fds */
        if (options->stdin_fd > STDERR_FILENO)