getlogin_r: fix missing fallback if loginid is unset (bug 30235)
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
When /proc/self/loginid is not set, we should still fall back to using the
traditional utmp lookup, instead of failing right away.
---
sysdeps/unix/sysv/linux/getlogin_r.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On Thu, Mar 16, 2023 at 12:58:40PM +0100, Andreas Schwab via Libc-alpha wrote:
> When /proc/self/loginid is not set, we should still fall back to using the
> traditional utmp lookup, instead of failing right away.
It's loginuid, not loginid.
@@ -59,10 +59,7 @@ __getlogin_r_loginuid (char *name, size_t namesize)
value of, (uid_t) -1, so check if that value is set and return early to
avoid making unneeded nss lookups. */
if (uid == (uid_t) -1)
- {
- __set_errno (ENXIO);
- return ENXIO;
- }
+ return -1;
struct passwd pwd;
struct passwd *tpwd;