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

savecore WARNS6 cleanup


From: Larry Lansing <lansil@xxxxxxxxxxxxx>
Date: Sun, 16 Jan 2005 16:44:12 -0500

Index: Makefile
===================================================================
RCS file: /home/dcvs/src/sbin/savecore/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	17 Jun 2003 04:27:34 -0000	1.2
+++ Makefile	16 Jan 2005 14:57:48 -0000
@@ -3,6 +3,7 @@
 # $DragonFly: src/sbin/savecore/Makefile,v 1.2 2003/06/17 04:27:34 dillon Exp $
 
 PROG=	savecore
+WARNS?=	6
 SRCS=	savecore.c
 MAN=	savecore.8
 
Index: savecore.c
===================================================================
RCS file: /home/dcvs/src/sbin/savecore/savecore.c,v
retrieving revision 1.8
diff -u -r1.8 savecore.c
--- savecore.c	18 Dec 2004 21:43:46 -0000	1.8
+++ savecore.c	16 Jan 2005 21:08:06 -0000
@@ -67,33 +67,33 @@
 
 struct nlist current_nl[] = {	/* Namelist for currently running system. */
 #define X_DUMPLO	0
-	{ "_dumplo" },
+	{ "_dumplo", 0, 0, 0, 0 },
 #define X_TIME		1
-	{ "_time_second" },
+	{ "_time_second", 0, 0, 0, 0 },
 #define	X_DUMPSIZE	2
-	{ "_dumpsize" },
+	{ "_dumpsize", 0, 0, 0, 0 },
 #define X_VERSION	3
-	{ "_version" },
+	{ "_version", 0, 0, 0, 0 },
 #define X_PANICSTR	4
-	{ "_panicstr" },
+	{ "_panicstr", 0, 0, 0, 0 },
 #define	X_DUMPMAG	5
-	{ "_dumpmag" },
+	{ "_dumpmag", 0, 0, 0, 0 },
 #define	X_KERNBASE	6
-	{ "_kernbase" },
-	{ "" },
+	{ "_kernbase", 0, 0, 0, 0 },
+	{ "", 0, 0, 0, 0 },
 };
 int cursyms[] = { X_DUMPLO, X_VERSION, X_DUMPMAG, -1 };
 int dumpsyms[] = { X_TIME, X_DUMPSIZE, X_VERSION, X_PANICSTR, X_DUMPMAG, -1 };
 
-struct nlist dump_nl[] = {	/* Name list for dumped system. */
-	{ "_dumplo" },		/* Entries MUST be the same as */
-	{ "_time_second" },	/*	those in current_nl[].  */
-	{ "_dumpsize" },
-	{ "_version" },
-	{ "_panicstr" },
-	{ "_dumpmag" },
-	{ "_kernbase" },
-	{ "" },
+struct nlist dump_nl[] = {               /* Name list for dumped system. */
+	{ "_dumplo", 0, 0, 0, 0 },       /* Entries MUST be the same as  */
+	{ "_time_second", 0, 0, 0, 0 },	 /* those in current_nl[].       */
+	{ "_dumpsize", 0, 0, 0, 0 },
+	{ "_version", 0, 0, 0, 0 },
+	{ "_panicstr", 0, 0, 0, 0 },
+	{ "_dumpmag", 0, 0, 0, 0 },
+	{ "_kernbase", 0, 0, 0, 0 },
+	{ "", 0, 0, 0, 0 },
 };
 
 /* Types match kernel declarations. */
@@ -136,6 +136,7 @@
 int	 Read(int, void *, int);
 void	 save_core(void);
 void	 usage(void);
+int	 verify_dev(char *, dev_t);
 void	 Write(int, void *, int);
 
 int
@@ -357,8 +358,8 @@
 void
 save_core(void)
 {
-	register FILE *fp;
-	register int bounds, ifd, nr, nw;
+	FILE *fp;
+	int bounds, ifd, nr, nw;
 	int hs, he = 0;		/* start and end of hole */
 	char path[MAXPATHLEN];
 	mode_t oumask;
@@ -502,7 +503,7 @@
  * specified device.
  */
 int
-verify_dev(char *name, register dev_t dev)
+verify_dev(char *name, dev_t dev)
 {
 	struct stat sb;
 
@@ -521,7 +522,7 @@
  *  3) as a last resort, try to create the node we need
  */
 void
-find_dev(register dev_t dev)
+find_dev(dev_t dev)
 {
 	struct dirent *ent;
 	char *dn, *dnp;
@@ -597,12 +598,12 @@
 int
 check_space(void)
 {
-	register FILE *fp;
+	FILE *fp;
 	const char *tkernel;
 	off_t minfree, spacefree, totfree, kernelsize, needed;
 	struct stat st;
 	struct statfs fsbuf;
-	char buf[100], path[MAXPATHLEN];
+	char mybuf[100], path[MAXPATHLEN];
 
 	tkernel = kernel ? kernel : getbootfile();
 	if (stat(tkernel, &st) < 0) {
@@ -622,10 +623,10 @@
 	if ((fp = fopen(path, "r")) == NULL)
 		minfree = 0;
 	else {
-		if (fgets(buf, sizeof(buf), fp) == NULL)
+		if (fgets(mybuf, sizeof(mybuf), fp) == NULL)
 			minfree = 0;
 		else
-			minfree = atoi(buf);
+			minfree = atoi(mybuf);
 		fclose(fp);
 	}
 
@@ -687,7 +688,7 @@
 void
 DumpWrite(int fd, void *bp, int size, off_t off, int flag)
 {
-	unsigned char buf[DUMPBUFSIZE], *p, *q;
+	unsigned char mybuf[DUMPBUFSIZE], *p, *q;
 	off_t pos;
 	int i, j;
 	
@@ -699,15 +700,15 @@
 	while (size) {
 		pos = off & ~(DUMPBUFSIZE - 1);
 		Lseek(fd, pos, flag);
-		Read(fd, buf, sizeof(buf));
+		Read(fd, mybuf, sizeof(mybuf));
 		j = off & (DUMPBUFSIZE - 1);
-		p = buf + j;
+		p = mybuf + j;
 		i = size;
 		if (i > DUMPBUFSIZE - j)
 			i = DUMPBUFSIZE - j;
 		memcpy(p, q, i);
 		Lseek(fd, pos, flag);
-		Write(fd, buf, sizeof(buf));
+		Write(fd, mybuf, sizeof(mybuf));
 		size -= i;
 		q += i;
 		off += i;
@@ -717,7 +718,7 @@
 void
 DumpRead(int fd, void *bp, int size, off_t off, int flag)
 {
-	unsigned char buf[DUMPBUFSIZE], *p, *q;
+	unsigned char mybuf[DUMPBUFSIZE], *p, *q;
 	off_t pos;
 	int i, j;
 	
@@ -729,9 +730,9 @@
 	while (size) {
 		pos = off & ~(DUMPBUFSIZE - 1);
 		Lseek(fd, pos, flag);
-		Read(fd, buf, sizeof(buf));
+		Read(fd, mybuf, sizeof(mybuf));
 		j = off & (DUMPBUFSIZE - 1);
-		p = buf + j;
+		p = mybuf + j;
 		i = size;
 		if (i > DUMPBUFSIZE - j)
 			i = DUMPBUFSIZE - j;



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