This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
getlogin() thoughts
- To: libc-alpha@cygnus.com
- Subject: getlogin() thoughts
- From: Dan Jacobowitz <drow@false.org>
- Date: Thu, 22 Oct 1998 17:09:55 -0400
- Mail-Followup-To: libc-alpha@cygnus.com
I've been playing around with the difficulties of getlogin() and output
redirection recently, and have two thoughts -
1. It seems that since libc6 only stdin is checked for tty-ness. In
libc5 stdin, stdout, or stderr could all be checked, allowing it to
function even if two of those were not ttys. Is readding this in any
way desirable?
2. The note in getlogin() says that the expectation is to return the
tty associated with fd 0. Under that, however, it mentions that using
the fd associated with open("/dev/tty") is not an alternative. There
is an effective alternative, however: /proc/self/stat's seventh field
is the major and minor number of the current process's controlling tty.
Just throwing that out in case anyone thinks it might be a useful
alternative.
Dan