[Midnightbsd-cvs] src [7169] trunk/sbin/init: check for null

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jul 26 15:19:42 EDT 2015


Revision: 7169
          http://svnweb.midnightbsd.org/src/?rev=7169
Author:   laffer1
Date:     2015-07-26 15:19:42 -0400 (Sun, 26 Jul 2015)
Log Message:
-----------
check for null

Modified Paths:
--------------
    trunk/sbin/init/init.8
    trunk/sbin/init/init.c

Modified: trunk/sbin/init/init.8
===================================================================
--- trunk/sbin/init/init.8	2015-07-26 18:22:27 UTC (rev 7168)
+++ trunk/sbin/init/init.8	2015-07-26 19:19:42 UTC (rev 7169)
@@ -290,7 +290,7 @@
 .Nm
 as follows:
 .Bl -column Run-level SIGTERM
-.It Sy "Run-level	Signal	Action
+.It Sy "Run-level	Signal	Action"
 .It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off"
 .It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode"
 .It Cm 6 Ta Dv SIGINT Ta "Reboot the machine"

Modified: trunk/sbin/init/init.c
===================================================================
--- trunk/sbin/init/init.c	2015-07-26 18:22:27 UTC (rev 7168)
+++ trunk/sbin/init/init.c	2015-07-26 19:19:42 UTC (rev 7169)
@@ -117,14 +117,14 @@
 
 static state_func_t run_script(const char *);
 
-enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
+static enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
 #define FALSE	0
 #define TRUE	1
 
-int Reboot = FALSE;
-int howto = RB_AUTOBOOT;
+static int Reboot = FALSE;
+static int howto = RB_AUTOBOOT;
 
-int devfs;
+static int devfs;
 
 static void transition(state_t);
 static state_t requested_transition;
@@ -685,7 +685,8 @@
 					_exit(0);
 				password = crypt(clear, pp->pw_passwd);
 				bzero(clear, _PASSWORD_LEN);
-				if (strcmp(password, pp->pw_passwd) == 0)
+				if (password == NULL ||
+				    strcmp(password, pp->pw_passwd) == 0)
 					break;
 				warning("single-user login failed\n");
 			}



More information about the Midnightbsd-cvs mailing list