]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix console infinite loop
authorDaniel Lezcano <daniel.lezcano@free.fr>
Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Mon, 10 May 2010 09:50:09 +0000 (11:50 +0200)
When the client console exits, the mainloop goes in an infinite loop
as the handler is not removed and we are notified from the disconnection
indefinitely.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/console.c

index f40fb0be21fafbf32c8c6d879de55226289fb1b0..123dc31d869f9a61430e4b3ccef85152ab9c01af 100644 (file)
@@ -237,6 +237,13 @@ static int console_handler(int fd, void *data, struct lxc_epoll_descr *descr)
                return 1;
        }
 
+       if (!r) {
+               INFO("console client has exited");
+               lxc_mainloop_del_handler(descr, fd);
+               close(fd);
+               return 0;
+       }
+
        /* no output for the console, do nothing */
        if (console->peer == -1)
                return 0;