From: Rachid Koucha <47061324+Rachid-Koucha@users.noreply.github.com> Date: Fri, 6 Dec 2019 14:07:47 +0000 (+0100) Subject: "busy" field set to -1 instead of 0 X-Git-Tag: lxc-4.0.0~80^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=730aaf46e0397a5142e6515db733d68c64e4d88f;p=thirdparty%2Flxc.git "busy" field set to -1 instead of 0 "busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it. Signed-off-by: Rachid Koucha --- diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c index aba8bb921..26b2d50d7 100644 --- a/src/lxc/terminal.c +++ b/src/lxc/terminal.c @@ -593,7 +593,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq) if (*ttyreq > ttys->max) goto out; - if (ttys->tty[*ttyreq - 1].busy) + if (ttys->tty[*ttyreq - 1].busy >= 0) goto out; /* The requested tty is available. */ @@ -602,7 +602,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq) } /* Search for next available tty, fixup index tty1 => [0]. */ - for (ttynum = 1; ttynum <= ttys->max && ttys->tty[ttynum - 1].busy; ttynum++) { + for (ttynum = 1; ttynum <= ttys->max && ttys->tty[ttynum - 1].busy >= 0; ttynum++) { ; } @@ -628,7 +628,7 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd) for (i = 0; i < ttys->max; i++) if (ttys->tty[i].busy == fd) - ttys->tty[i].busy = 0; + ttys->tty[i].busy = -1; if (terminal->proxy.busy != fd) return;