[9449] in Athena Bugs
getlogin() doesn't return NULL
daemon@ATHENA.MIT.EDU (Black Dragon)
Thu Jun 11 13:49:00 1992
Date: Thu, 11 Jun 92 13:48:50 -0400
To: bugs@Athena.MIT.EDU
From: tlyu@Athena.MIT.EDU (Black Dragon)
Reply-To: <tlyu@Athena.MIT.EDU>
when getlogin() is called where the current tty doesn't have a user name
entered in /etc/utmp, it returns a zero-length string instead of a NULL
pointer, as is documented in the man page. I have observed this behavior both
on decmipses and RTs. What first called my attention to this problem was
get_message -l -z zwriting to instance personal. get_message -z ends up
calling getlogin() and then calling getuid() if that returns NULL. Since
getlogin doesn't return NULL if the user is not in /etc/utmp, getuid() is not
called, and zwrite is called with a null recipient, resulting in a zwrite to
<message,personal,*>.
references: getlogin(3), source for get_message