[CRIU] [PATCH] tty: Fix path inversion for /dev/pts/ptmx

Cyrill Gorcunov gorcunov at openvz.org
Thu Oct 23 10:43:32 PDT 2014


Need to compare the /pts/ part in the
former path, otherwise it will produce
bogus /dev/pts/pts/index form.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tty.c b/tty.c
index 276bd284aa43..66f969b4cb60 100644
--- a/tty.c
+++ b/tty.c
@@ -332,7 +332,7 @@ static struct reg_file_info *pty_alloc_fake_reg(struct tty_info *info, int type)
 		if (type == TTY_TYPE_PTM)
 			strcat(inverted_path, "ptmx");
 		else {
-			if (slash_at >= 4 && strcmp(&inverted_path[slash_at - 4], "pts"))
+			if (slash_at >= 3 && strcmp(&inverted_path[slash_at - 3], "pts", 3))
 				snprintf(&inverted_path[slash_at + 1], 10, "pts/%u",
 					 info->tie->pty->index);
 			else
-- 
1.9.3



More information about the CRIU mailing list