[PATCH] linux ttyname and ttyname_r: return link if appropriate

Dmitry V. Levin ldv@altlinux.org
Tue Aug 9 21:18:00 GMT 2016


On Sat, Aug 06, 2016 at 10:00:02AM -0500, Serge E. Hallyn wrote:
[...]
> Subject: [PATCH] linux ttyname and ttyname_r: return link if appropriate

Please compare

> @@ -170,12 +184,17 @@ ttyname (int fd)
>  #ifdef _STATBUF_ST_RDEV
>  	  && S_ISCHR (st1.st_mode)
>  	  && st1.st_rdev == st.st_rdev
> -#else
> -	  && st1.st_ino == st.st_ino
> -	  && st1.st_dev == st.st_dev
>  #endif
> +	  && st1.st_dev == st.st_dev
> +	  && st1.st_ino == st.st_ino

with

> @@ -152,12 +166,20 @@ __ttyname_r (int fd, char *buf, size_t buflen)
>  #ifdef _STATBUF_ST_RDEV
>  	  && S_ISCHR (st1.st_mode)
>  	  && st1.st_rdev == st.st_rdev
> -#else
> +#endif
>  	  && st1.st_ino == st.st_ino
>  	  && st1.st_dev == st.st_dev
> -#endif

Wouldn't it be better if both functions implemented these comparisons
exactly the same way?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160809/78eedef7/attachment.sig>


More information about the Libc-alpha mailing list