dmesg WARNS6 cleanup

Peter Schuller peter.schuller at infidyne.com
Sat Jan 8 08:45:21 PST 2005


(Perhaps I should add a version of NLIST_NAME() for the _AOUT_INCLUDE_ case?)

-- 
/ Peter Schuller, InfiDyne Technologies HB

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

--- sbin/dmesg/dmesg.c.orig	2005-01-08 08:37:34.000000000 +0000
+++ sbin/dmesg/dmesg.c	2005-01-08 08:39:07.000000000 +0000
@@ -52,8 +52,8 @@
 
 struct nlist nl[] = {
 #define	X_MSGBUF	0
-	{ "_msgbufp" },
-	{ NULL },
+        NLIST_NAME("_msgbufp"),
+        NLIST_NULL,
 };
 
 void usage(void);
@@ -72,8 +72,7 @@
 	char buf[5];
 	int all = 0;
 	int pri = 0;
-	size_t buflen;
-	int bufpos;
+	size_t buflen, bufpos;
 
 	setlocale(LC_CTYPE, "");
 	memf = nlistf = NULL;
@@ -124,7 +123,7 @@
 		if (!bp)
 			errx(1, "malloc failed");
 		if (kvm_read(kd, (long)cur.msg_ptr, bp, cur.msg_size) !=
-		    cur.msg_size)
+		    (ssize_t)cur.msg_size)
 			errx(1, "kvm_read: %s", kvm_geterr(kd));
 		kvm_close(kd);
 		buflen = cur.msg_size;
--- include/nlist.h.orig	2005-01-08 08:33:27.000000000 +0000
+++ include/nlist.h	2005-01-08 08:37:15.000000000 +0000
@@ -68,6 +68,12 @@
 	unsigned long n_value;	/* address/value of the symbol */
 };
 
+/* Initializes an nlist with the given n_name but otherwise zeroed */
+#define NLIST_NAME(name) { #name, 0, '\0', 0, 0 }
+
+/* Terminates arrays of nlist structures */
+#define NLIST_NULL { NULL, 0, '\0', 0, 0 }
+
 #define	n_hash	n_desc		/* used internally by ld(1); XXX */
 
 /*




More information about the Submit mailing list