This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: pgpgum2IBfcib.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]