Unverified Commit 64b23e10 by Rachid Koucha Committed by Christian Brauner

"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: 's avatarRachid Koucha <rachid.koucha@gmail.com>
parent 1bcae9fb
...@@ -593,7 +593,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq) ...@@ -593,7 +593,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq)
if (*ttyreq > ttys->max) if (*ttyreq > ttys->max)
goto out; goto out;
if (ttys->tty[*ttyreq - 1].busy) if (ttys->tty[*ttyreq - 1].busy >= 0)
goto out; goto out;
/* The requested tty is available. */ /* The requested tty is available. */
...@@ -602,7 +602,7 @@ int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq) ...@@ -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]. */ /* 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) ...@@ -628,7 +628,7 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
for (i = 0; i < ttys->max; i++) for (i = 0; i < ttys->max; i++)
if (ttys->tty[i].busy == fd) if (ttys->tty[i].busy == fd)
ttys->tty[i].busy = 0; ttys->tty[i].busy = -1;
if (terminal->proxy.busy != fd) if (terminal->proxy.busy != fd)
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment