]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: move new_cwd into tighter scope
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 29 Jan 2021 13:24:31 +0000 (14:24 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 29 Jan 2021 13:24:31 +0000 (14:24 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index 3824672376feedfe8d512056741c81d9108e7c80..1b47fdc816029395e04907cda57896d2aa95f96f 100644 (file)
@@ -1051,7 +1051,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
        int ret_parent = -1;
        struct lxc_epoll_descr descr = {};
        int ret;
-       char *name, *lxcpath, *new_cwd;
+       char *name, *lxcpath;
        int ipc_sockets[2];
        pid_t attached_pid, pid, to_cleanup_pid;
        struct attach_context *ctx;
@@ -1182,7 +1182,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
        }
 
        if (pid == 0) {
-               char *cwd;
+               char *cwd, *new_cwd;
 
                /* close unneeded file descriptors */
                close_prot_errno_disarm(ipc_sockets[0]);