[Pkg-shadow-commits] r2743 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Wed Apr 22 20:07:34 UTC 2009


Author: nekral-guest
Date: 2009-04-22 20:07:34 +0000 (Wed, 22 Apr 2009)
New Revision: 2743

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/login.c
Log:
	* src/login.c: utent might be NULL after get_current_utmp().


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-04-22 20:03:26 UTC (rev 2742)
+++ upstream/trunk/ChangeLog	2009-04-22 20:07:34 UTC (rev 2743)
@@ -1,3 +1,7 @@
+2009-04-22  Paul Szabo  <psz at maths.usyd.edu.au>
+
+	* src/login.c: utent might be NULL after get_current_utmp().
+
 2009-04-22  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* src/login.c: Removed temp_shell. No more used.

Modified: upstream/trunk/src/login.c
===================================================================
--- upstream/trunk/src/login.c	2009-04-22 20:03:26 UTC (rev 2742)
+++ upstream/trunk/src/login.c	2009-04-22 20:07:34 UTC (rev 2743)
@@ -563,6 +563,7 @@
 		(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,15 +656,12 @@
 
 	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) {




More information about the Pkg-shadow-commits mailing list