]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/start.c
conf: simplify tty handling
[mirror_lxc.git] / src / lxc / start.c
index 21a1140e6b699bc2e9d38830caa0433b780801d7..048b97b4fc047a0651d30bd089d044cb40c44f4e 100644 (file)
@@ -1331,8 +1331,8 @@ static int do_start(void *data)
                goto out_warn_father;
        }
 
-       if (handler->conf->pty_names) {
-               ret = putenv(handler->conf->pty_names);
+       if (handler->conf->ttys.tty_names) {
+               ret = putenv(handler->conf->ttys.tty_names);
                if (ret < 0) {
                        SYSERROR("Failed to set environment variable for container ptys");
                        goto out_warn_father;
@@ -1397,14 +1397,14 @@ static int lxc_recv_ttys_from_child(struct lxc_handler *handler)
        struct lxc_conf *conf = handler->conf;
        struct lxc_tty_info *ttys = &conf->ttys;
 
-       if (!conf->tty)
+       if (!conf->ttys.max)
                return 0;
 
-       ttys->tty = malloc(sizeof(*ttys->tty) * conf->tty);
+       ttys->tty = malloc(sizeof(*ttys->tty) * ttys->max);
        if (!ttys->tty)
                return -1;
 
-       for (i = 0; i < conf->tty; i++) {
+       for (i = 0; i < conf->ttys.max; i++) {
                int ttyfds[2];
 
                ret = lxc_abstract_unix_recv_fds(sock, ttyfds, 2, NULL, 0);
@@ -1419,12 +1419,10 @@ static int lxc_recv_ttys_from_child(struct lxc_handler *handler)
                      "parent", tty->master, tty->slave);
        }
        if (ret < 0)
-               ERROR("Failed to receive %d ttys from child: %s", conf->tty,
+               ERROR("Failed to receive %zu ttys from child: %s", ttys->max,
                      strerror(errno));
        else
-               TRACE("Received %d ttys from child", conf->tty);
-
-       ttys->nbtty = conf->tty;
+               TRACE("Received %zu ttys from child", ttys->max);
 
        return ret;
 }