Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jul 2001 17:08:13 -0400 (EDT)
From:      Mike Barcroft <mike@q9media.com>
To:        audit@FreeBSD.org
Subject:   src/sbin/shutdown patch
Message-ID:  <200107052108.f65L8Do10449@coffee.q9media.com>

next in thread | raw e-mail | index | archive | help
I would appreciate it if someone would review and commit the patch at
the end of this message.  Also available at:
http://testbed.q9media.net/freebsd/shutdown.20010705.patch

Best regards,
Mike Barcroft

-----------------------------------------------------------------------

shutdown.20010705.patch

o Mark unused variables
o Constify
o Remove register storage-classes
o Fix some comparison between signed and unsigned warnings
o Set WARNS?=2
o Untested on Alpha


Index: shutdown/Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/shutdown/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- shutdown/Makefile	2001/03/26 14:33:23	1.5
+++ shutdown/Makefile	2001/07/05 20:46:14
@@ -2,6 +2,7 @@
 # $FreeBSD: src/sbin/shutdown/Makefile,v 1.5 2001/03/26 14:33:23 ru Exp $
 
 PROG=	shutdown
+WARNS?=	2
 MAN=	shutdown.8
 BINGRP=	operator
 BINMODE=4550
Index: shutdown/shutdown.c
===================================================================
RCS file: /home/ncvs/src/sbin/shutdown/shutdown.c,v
retrieving revision 1.21
diff -u -r1.21 shutdown.c
--- shutdown/shutdown.c	1999/08/28 00:14:24	1.21
+++ shutdown/shutdown.c	2001/07/05 20:46:14
@@ -94,7 +94,8 @@
 
 static time_t offset, shuttime;
 static int dohalt, dopower, doreboot, killflg, mbuflen, oflag;
-static char *nosync, *whom, mbuf[BUFSIZ];
+static char mbuf[BUFSIZ];
+static const char *nosync, *whom;
 
 void badtime __P((void));
 void die_you_gravy_sucking_pig_dog __P((void));
@@ -111,7 +112,7 @@
 	int argc;
 	char *argv[];
 {
-	register char *p, *endp;
+	char *p, *endp;
 	struct passwd *pw;
 	int arglen, ch, len, readstdin;
 
@@ -247,7 +248,7 @@
 		 * the next wait time.
 		 */
 		if ((sltime = offset - tp->timeleft)) {
-			if (sltime > tp->timetowait / 5)
+			if (sltime > (u_int)(tp->timetowait / 5))
 				timewarn(offset);
 			(void)sleep(sltime);
 		}
@@ -267,7 +268,7 @@
 
 static jmp_buf alarmbuf;
 
-static char *restricted_environ[] = {
+static const char *restricted_environ[] = {
 	"PATH=" _PATH_STDPATH,
 	NULL
 };
@@ -280,7 +281,7 @@
 	static char hostname[MAXHOSTNAMELEN + 1];
 	FILE *pf;
 	char wcmd[MAXPATHLEN + 4];
-	extern char **environ;
+	extern const char **environ;
 
 	if (!first++)
 		(void)gethostname(hostname, sizeof(hostname));
@@ -326,7 +327,7 @@
 
 void
 timeout(signo)
-	int signo;
+	int signo __unused;
 {
 	longjmp(alarmbuf, 1);
 }
@@ -394,10 +395,10 @@
 
 void
 getoffset(timearg)
-	register char *timearg;
+	char *timearg;
 {
-	register struct tm *lt;
-	register char *p;
+	struct tm *lt;
+	char *p;
 	time_t now;
 	int this_year;
 
@@ -500,7 +501,7 @@
 
 void
 finish(signo)
-	int signo;
+	int signo __unused;
 {
 	if (!killflg)
 		(void)unlink(_PATH_NOLOGIN);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107052108.f65L8Do10449>