* src/login.c: utent might be NULL after get_current_utmp().
This commit is contained in:
parent
332a50c273
commit
a362a68f53
@ -1,3 +1,7 @@
|
||||
2009-04-22 Paul Szabo <psz@maths.usyd.edu.au>
|
||||
|
||||
* src/login.c: utent might be NULL after get_current_utmp().
|
||||
|
||||
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* src/login.c: Removed temp_shell. No more used.
|
||||
|
@ -563,6 +563,7 @@ int main (int argc, char **argv)
|
||||
(void) puts (_("No utmp entry. You must exec \"login\" from the lowest level \"sh\""));
|
||||
exit (1);
|
||||
}
|
||||
/* NOTE: utent might be NULL afterwards */
|
||||
|
||||
tmptty = ttyname (0);
|
||||
if (NULL == tmptty) {
|
||||
@ -655,16 +656,13 @@ int main (int argc, char **argv)
|
||||
|
||||
if (rflg || hflg) {
|
||||
cp = hostname;
|
||||
} else {
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
if ('\0' != utent->ut_host[0]) {
|
||||
} else if ((NULL != utent) && ('\0' != utent->ut_host[0])) {
|
||||
cp = utent->ut_host;
|
||||
} else
|
||||
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
{
|
||||
} else {
|
||||
cp = "";
|
||||
}
|
||||
}
|
||||
|
||||
if ('\0' != *cp) {
|
||||
snprintf (fromhost, sizeof fromhost,
|
||||
|
Loading…
Reference in New Issue
Block a user