+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.
(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) {
if (rflg || hflg) {
cp = hostname;
- } else {
#ifdef HAVE_STRUCT_UTMP_UT_HOST
- if ('\0' != utent->ut_host[0]) {
- cp = utent->ut_host;
- } else
+ } else if ((NULL != utent) && ('\0' != utent->ut_host[0])) {
+ cp = utent->ut_host;
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
- {
- cp = "";
- }
+ } else {
+ cp = "";
}
if ('\0' != *cp) {