Merge pull request #2358 from brauner/2018-05-28/do_not_init_ns_clone_flags

start: do not init ns_clone_flags to -1
This commit is contained in:
Stéphane Graber 2018-05-28 10:29:15 -04:00 committed by GitHub
commit 5c478fb543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -968,6 +968,8 @@ int lxc_allocate_ttys(const char *name, struct lxc_conf *conf)
for (i = 0; i < ttys->max; i++) {
struct lxc_terminal_info *tty = &ttys->tty[i];
tty->master = -EBADF;
tty->slave = -EBADF;
ret = openpty(&tty->master, &tty->slave,
tty->name, NULL, NULL);
if (ret) {
@ -1004,11 +1006,21 @@ void lxc_delete_tty(struct lxc_tty_info *ttys)
{
int i;
if (!ttys->tty)
return;
for (i = 0; i < ttys->max; i++) {
struct lxc_terminal_info *tty = &ttys->tty[i];
close(tty->master);
close(tty->slave);
if (tty->master >= 0) {
close(tty->master);
tty->master = -EBADF;
}
if (tty->slave >= 0) {
close(tty->slave);
tty->slave = -EBADF;
}
}
free(ttys->tty);

View File

@ -619,8 +619,6 @@ void lxc_zero_handler(struct lxc_handler *handler)
memset(handler, 0, sizeof(struct lxc_handler));
handler->ns_clone_flags = -1;
handler->pinfd = -1;
handler->sigfd = -1;