Commit 316820c3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

tty: Don't forget to add eol when inverting slave pts paths

Otherwise next strcat get confused

 | (00.024843)     26: Error (files-reg.c:1528): Can't open file dev/pts/g:��^?ptmx on restore: No such file or directory
 | (00.024846)     26: Error (files-reg.c:1470): Can't open file dev/pts/g:��^?ptmx: No such file or directory
 | (00.024849)     26: Error (tty.c:545): tty: Can't open dev/pts/g:��^?ptmx: No such file or directory
Reported-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@virtuozzo.com>
Reviewed-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Tested-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 8ba63724
......@@ -485,9 +485,10 @@ static struct reg_file_info *pty_alloc_fake_reg(struct tty_info *info, int subty
BUG_ON(!pos || !inverted_path);
memcpy(inverted_path, orig->rfe->name, slash_at + 1);
if (subtype == TTY_SUBTYPE_MASTER)
if (subtype == TTY_SUBTYPE_MASTER) {
inverted_path[slash_at + 1] = '\0';
strcat(inverted_path, "ptmx");
else {
} else {
if (slash_at >= 3 && strncmp(&inverted_path[slash_at - 3], "pts", 3))
snprintf(&inverted_path[slash_at + 1], 10, "pts/%u",
info->tie->pty->index);
......
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