[PATCH] Fix getlogin() to check only stdin to get a valid tty
Stefan Tauner
stefan.tauner@gmx.at
Thu Jul 13 21:12:49 GMT 2023
On Thu, 13 Jul 2023 18:57:32 +0200
Jordi Sanfeliu via Newlib <newlib@sourceware.org> wrote:
> - if (((tty = ttyname (0)) == 0)
> - || ((tty = ttyname (1)) == 0)
> - || ((tty = ttyname (2)) == 0))
> - return 0;
> + if ((tty = ttyname (0)) == 0)
> + if ((tty = ttyname (1)) == 0)
> + if ((tty = ttyname (2)) == 0)
> + return 0;
IMHO the bug arose simply because of a || vs. && confusion. You can
just replace the || with && and have exactly the same effect as this
patch but it would be more customary.
--
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
More information about the Newlib
mailing list