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

Pavel Emelyanov xemul at parallels.com
Thu Oct 23 10:56:47 PDT 2014


On 10/23/2014 09:43 PM, Cyrill Gorcunov wrote:
> 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))

How did you test it? The strcmp takes only 2 args.

>  				snprintf(&inverted_path[slash_at + 1], 10, "pts/%u",
>  					 info->tie->pty->index);
>  			else
> 



More information about the CRIU mailing list