Subject: bug#1688: 23.0.60; ttname returned by system-process-attributes points to nonexisting file

From: Eli Zaretskii <[email-masked]>
Date: Mon, 12 Jan 2009 21:19:39 +0200

> Date: Tue, 13 Jan 2009 01:17:23 +0800
> From: richardeng <[email-masked]>
> Cc: [email-masked]
> 
> --- sysdep.c.~1.328.~   2009-01-03 07:04:59.000000000 -0800
> +++ sysdep.c    2009-01-13 01:09:56.000000000 -0800
> @@ -3322,7 +3322,7 @@
> 
>  	       if (MINOR (rdev) >= minor_beg && MINOR (rdev) <= minor_end)
>   		 {
> -		   sprintf (name + strlen (name), "%lu", MINOR (rdev));
> +		   sprintf (name + strlen (name), "/%lu", MINOR (rdev));
>   		   break;
>   		 }                                                                                              
It's not that simple: what happens if `name' is something like "ptys"
or "tty"?  We need to generate "ptys2" and "tty39" for them, not
"ptys/2" and "tty/39".

So a more complex logic is required here.

Faced with this difficulty, I decided not to bother, since the value
of `ttname' is not documented to return a valid file name.

Perhaps some Linux guru (which I ain't) can suggest an easy solution.