* 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>
|
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/login.c: Removed temp_shell. No more used.
|
* src/login.c: Removed temp_shell. No more used.
|
||||||
|
12
src/login.c
12
src/login.c
@ -563,6 +563,7 @@ int main (int argc, char **argv)
|
|||||||
(void) puts (_("No utmp entry. You must exec \"login\" from the lowest level \"sh\""));
|
(void) puts (_("No utmp entry. You must exec \"login\" from the lowest level \"sh\""));
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
/* NOTE: utent might be NULL afterwards */
|
||||||
|
|
||||||
tmptty = ttyname (0);
|
tmptty = ttyname (0);
|
||||||
if (NULL == tmptty) {
|
if (NULL == tmptty) {
|
||||||
@ -655,15 +656,12 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if (rflg || hflg) {
|
if (rflg || hflg) {
|
||||||
cp = hostname;
|
cp = hostname;
|
||||||
} else {
|
|
||||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
#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;
|
cp = utent->ut_host;
|
||||||
} else
|
|
||||||
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||||
{
|
} else {
|
||||||
cp = "";
|
cp = "";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('\0' != *cp) {
|
if ('\0' != *cp) {
|
||||||
|
Loading…
Reference in New Issue
Block a user