Re: [PATCH] Fix getlogin() to check only stdin to get a valid tty
Stefan Tauner <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 13 Jul 2023 18:57:32 +0200 Jordi Sanfeliu via Newlib <[email protected]> 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