[PATCH 3/3] linux: implement ttyname as a wrapper around ttyname_r.

Érico Nogueira ericonr@disroot.org
Fri May 7 19:20:57 GMT 2021


On Fri May 7, 2021 at 2:21 PM -03, Adhemerval Zanella wrote:
>
>
> On 04/05/2021 13:43, Adhemerval Zanella wrote:
> > 
> > 
> > On 04/05/2021 13:37, Adhemerval Zanella wrote:
> >>> -
> >>> -  if (!name && dostat != -1)
> >>> +  int result = ttyname_r (fd, ttyname_buf, TTYNAME_BUFLEN);
> >>> +  if (result != 0)
> >>
> >> Why do you need to pass the allocated buffer size minus 1? The ttyname_r 
> >> should handle it, it already pass buflen - 1 on readlink for instance.
> > 
> > You also need a libc_hidden_{proto,def} ttyname_r to avoid the intra
> > PLT (the elf/check-localplt should have warned you about it).
> > 
>
> I fixed my previous noted issues along with this one and push it
> upstream, thanks for the patch.

Ah, great! I hadn't gotten to this yet, thanks a lot for the help and
reviews :)


More information about the Libc-alpha mailing list