DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

sysctl warns6 cleanup


From: Peter Schuller <peter.schuller@xxxxxxxxxxxx>
Date: Sat, 8 Jan 2005 17:17:17 +0100

Attached.

-- 
/ Peter Schuller, InfiDyne Technologies HB

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@xxxxxxxxxxxx>'
Key retrieval: Send an E-Mail to getpgpkey@xxxxxxxxx
E-Mail: peter.schuller@xxxxxxxxxxxx Web: http://www.scode.org

--- sbin/sysctl/Makefile.orig	2005-01-02 03:41:02.000000000 +0000
+++ sbin/sysctl/Makefile	2005-01-08 07:54:09.000000000 +0000
@@ -4,5 +4,6 @@
 
 PROG=	sysctl
 MAN=	sysctl.8
+WARNS?= 6
 
 .include <bsd.prog.mk>
--- sbin/sysctl/sysctl.c.orig	2005-01-02 03:41:06.000000000 +0000
+++ sbin/sysctl/sysctl.c	2005-01-08 08:02:27.000000000 +0000
@@ -405,7 +405,7 @@
  */
 struct _foo {
 	int majdev;
-	char *name;
+	const char *name;
 } maj2name[] = {
 	{ 30,	"ad" },
 	{ 0,	"wd" },
@@ -459,7 +459,8 @@
 show_var(int *oid, int nlen)
 {
 	u_char buf[BUFSIZ], *val, *p;
-	char name[BUFSIZ], *fmt, *sep;
+	char name[BUFSIZ], *fmt;
+	const char *sep;
 	int qoid[CTL_MAXNAME+2];
 	int i;
 	size_t j, len;
@@ -518,20 +519,20 @@
 	case 'A':
 		if (!nflag)
 			printf("%s%s", name, sep);
-		printf("%.*s", len, p);
+		printf("%.*s", (int)len, p);
 		return (0);
 		
 	case 'I':
 		if (!nflag)
 			printf("%s%s", name, sep);
 		fmt++;
-		val = "";
+		strcpy(val, "");
 		while (len >= sizeof(int)) {
 			if(*fmt == 'U')
 				printf("%s%u", val, *(unsigned int *)p);
 			else
 				printf("%s%d", val, *(int *)p);
-			val = " ";
+			strcpy(val, " ");
 			len -= sizeof(int);
 			p += sizeof(int);
 		}
@@ -545,13 +546,13 @@
 		if (!strcmp(name, "machdep.guessed_bootdev"))
 			return machdep_bootdev(*(unsigned long *)p);
 #endif
-		val = "";
+		strcpy(val, "");
 		while (len >= sizeof(long)) {
 			if(*fmt == 'U')
 				printf("%s%lu", val, *(unsigned long *)p);
 			else
 				printf("%s%ld", val, *(long *)p);
-			val = " ";
+			strcpy(val, " ");
 			len -= sizeof(long);
 			p += sizeof(long);
 		}
@@ -567,13 +568,13 @@
 		if (!nflag)
 			printf("%s%s", name, sep);
 		fmt++;
-		val = "";
+		strcpy(val, "");
 		while (len >= sizeof(int64_t)) {
 			if(*fmt == 'U')
 				printf("%s%llu", val, (long long)*(u_int64_t *)p);
 			else
 				printf("%s%lld", val, (long long)*(int64_t *)p);
-			val = " ";
+			strcpy(val, " ");
 			len -= sizeof(int64_t);
 			p += sizeof(int64_t);
 		}
@@ -644,7 +645,7 @@
 
 		l2 /= sizeof(int);
 
-		if (l2 < len)
+		if (l2 < (size_t)len)
 			return 0;
 
 		for (i = 0; i < len; i++)


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]