]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: use tighter scope for fd variable 2934/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 13 Apr 2019 17:08:49 +0000 (19:08 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 13 Apr 2019 17:08:49 +0000 (19:08 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index 11a6ba26b4ae3320b6b6c5efe1e918d651c42657..f2a1339d3f61c0469cf2c061c49f2515e388cba3 100644 (file)
@@ -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);