[lxc-devel] [lxc/master] attach: use tighter scope for fd variable
brauner on Github
lxc-bot at linuxcontainers.org
Sat Apr 13 17:09:30 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190413/90e90cb9/attachment.bin>
-------------- next part --------------
From 427a80672ffa1459e68a6bcec2112b0f67754ce7 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 13 Apr 2019 19:08:49 +0200
Subject: [PATCH] attach: use tighter scope for fd variable
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/attach.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index 11a6ba26b4..f2a1339d3f 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -700,7 +700,7 @@ static void lxc_put_attach_clone_payload(struct attach_clone_payload *p)
static int attach_child_main(struct attach_clone_payload *payload)
{
- int fd, lsm_fd, ret;
+ int lsm_fd, ret;
uid_t new_uid;
gid_t new_gid;
uid_t ns_root_uid = 0;
@@ -893,10 +893,11 @@ static int attach_child_main(struct attach_clone_payload *payload)
if (options->stderr_fd > STDERR_FILENO)
close(options->stderr_fd);
- /* Try to remove FD_CLOEXEC flag from stdin/stdout/stderr, but also
+ /*
+ * Try to remove FD_CLOEXEC flag from stdin/stdout/stderr, but also
* here, ignore errors.
*/
- for (fd = STDIN_FILENO; fd <= STDERR_FILENO; fd++) {
+ for (int fd = STDIN_FILENO; fd <= STDERR_FILENO; fd++) {
ret = fd_cloexec(fd, false);
if (ret < 0) {
SYSERROR("Failed to clear FD_CLOEXEC from file descriptor %d", fd);
More information about the lxc-devel
mailing list