From: Christian Brauner Date: Wed, 27 Jan 2021 19:55:02 +0000 (+0100) Subject: attach: add some DEBUG() logging to stdfd dpulication X-Git-Tag: lxc-5.0.0~314^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b495984869abb70c7a7223d143efbce9694047f2;p=thirdparty%2Flxc.git attach: add some DEBUG() logging to stdfd dpulication Cc: stable-4.0 Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index c5669128c..df82cd28d 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -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)