]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
terminal: lxc_terminal_free()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 28 Feb 2018 11:14:04 +0000 (12:14 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 28 Feb 2018 16:08:08 +0000 (17:08 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/terminal.c

index a0d3144c53433e4931e20e9709d5dfbadc2fd8ba..611ea7d468704d07101e9ba320f98cd0fa6cf445 100644 (file)
@@ -653,15 +653,15 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
        struct lxc_tty_info *ttys = &conf->ttys;
        struct lxc_terminal *terminal = &conf->console;
 
-       for (i = 0; i < ttys->nbtty; i++) {
+       for (i = 0; i < ttys->nbtty; i++)
                if (ttys->tty[i].busy == fd)
                        ttys->tty[i].busy = 0;
-       }
 
-       if (terminal->proxy.busy == fd) {
-               lxc_mainloop_del_handler(terminal->descr, terminal->proxy.slave);
-               lxc_terminal_peer_proxy_free(terminal);
-       }
+       if (terminal->proxy.busy != fd)
+               return;
+
+       lxc_mainloop_del_handler(terminal->descr, terminal->proxy.slave);
+       lxc_terminal_peer_proxy_free(terminal);
 }
 
 static int lxc_terminal_peer_default(struct lxc_terminal *terminal)