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

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue May 4 16:43:25 GMT 2021



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).


More information about the Libc-alpha mailing list