diff options
author | Ulrich Drepper <drepper@redhat.com> | 2010-03-24 17:02:57 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2010-03-24 17:02:57 -0700 |
commit | c8727fa6e5073d28ed6d0eb40a006ac2c1b9f9f3 (patch) | |
tree | 23369e9301bb60abd73e4384e7974fa32acd6e57 /sysdeps/unix/getlogin_r.c | |
parent | fd8ccb0427569ffdfbb70c8828029122f3459160 (diff) |
Fix Linux getlogin{_r,} implementation
The old implementation uses fd 0 to determine the login TTY. This
was needed because using /dev/tty it is not possible to deduce the
login TTY. For some time now there is the pseudo-file
/proc/self/loginuid which directly helps us to find the user. Prefer
using this file. It also works if stdin is closed, redirected, or
re-opened.
Diffstat (limited to 'sysdeps/unix/getlogin_r.c')
-rw-r--r-- | sysdeps/unix/getlogin_r.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c index ba7badd054..bf3c889e13 100644 --- a/sysdeps/unix/getlogin_r.c +++ b/sysdeps/unix/getlogin_r.c @@ -1,5 +1,5 @@ /* Reentrant function to return the current login name. Unix version. - Copyright (C) 1991,92,96,97,98,2002 Free Software Foundation, Inc. + Copyright (C) 1991,92,96,97,98,2002,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,6 +31,9 @@ If it cannot be determined or some other error occurred, return the error code. Otherwise return 0. */ +#ifdef STATIC +STATIC +#endif int getlogin_r (name, name_len) char *name; @@ -96,4 +99,6 @@ getlogin_r (name, name_len) return result; } +#ifndef STATIC libc_hidden_def (getlogin_r) +#endif |