terminal: safely retrieve path of slave device
terminal: safely retrieve path of slave device

openpty() is a horrible function that uses strcpy() into the char *name
argument if name != NULL. We can't rely on the path being sane in all cases so
let's split out the name retrieval to ttyname_r().

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

caglar10ur/lxc,ss1h2a3tw/lxc,hallyn/lxc,hallyn/lxc,caglar10ur/lxc,hallyn/lxc,ss1h2a3tw/lxc,caglar10ur/lxc,ss1h2a3tw/lxc