conf: fix tty creation
conf: fix tty creation

We allocate pty {master,slave} file descriptors in the childs namespaces after
we have setup devpts. After we have sent the pty file descriptors to the parent
and set up the pty file descriptors under /dev/tty* and before we exec the init
binary we need to delete these file descriptors in the child. However, one of
my commits made the deletion occur before setting up the file descriptors under
/dev/tty*. This caused a failures when trying to attach to the container's ttys
since they werent actually configured although the file descriptors were
available in the in-memory configuration of the parent.
This commit reworks setting up tty such that deletion occurs after all setup
has been performed. The commit is actually minimal but needs to also move all
the functions into one place since they well now be called from
"lxc_create_ttys()".

Signed-off-by: Christian Brauner <48455ab3070520a2d174545c7239d6d0fabd9a83@ubuntu.com>

hallyn/lxc,ss1h2a3tw/lxc,ss1h2a3tw/lxc,hallyn/lxc,thmo/lxc,caglar10ur/lxc,thmo/lxc,hallyn/lxc,ss1h2a3tw/lxc,terceiro/lxc,thmo/lxc,caglar10ur/lxc,caglar10ur/lxc,terceiro/lxc,terceiro/lxc