svn commit: r367150 - head/sbin/savecore

Gleb Smirnoff glebius at FreeBSD.org
Thu Oct 29 23:15:11 UTC 2020


Author: glebius
Date: Thu Oct 29 23:15:11 2020
New Revision: 367150
URL: https://svnweb.freebsd.org/changeset/base/367150

Log:
  Convert flags from int to bool.  Some (compress) were already used in
  comparisons with bool values.  No functional changes.

Modified:
  head/sbin/savecore/savecore.c

Modified: head/sbin/savecore/savecore.c
==============================================================================
--- head/sbin/savecore/savecore.c	Thu Oct 29 22:22:27 2020	(r367149)
+++ head/sbin/savecore/savecore.c	Thu Oct 29 23:15:11 2020	(r367150)
@@ -102,7 +102,8 @@ __FBSDID("$FreeBSD$");
 
 static cap_channel_t *capsyslog;
 static fileargs_t *capfa;
-static int checkfor, compress, clear, force, keep, verbose;	/* flags */
+static bool checkfor, compress, clear, force, keep;	/* flags */
+static int verbose;
 static int nfound, nsaved, nerr;			/* statistics */
 static int maxdumps;
 
@@ -676,7 +677,7 @@ DoFile(const char *savedir, int savedirfd, const char 
 			    dtoh32(kdhl.version), device);
 
 			status = STATUS_BAD;
-			if (force == 0)
+			if (force == false)
 				goto closefd;
 		}
 	} else if (compare_magic(&kdhl, KERNELDUMPMAGIC)) {
@@ -686,7 +687,7 @@ DoFile(const char *savedir, int savedirfd, const char 
 			    dtoh32(kdhl.version), device);
 
 			status = STATUS_BAD;
-			if (force == 0)
+			if (force == false)
 				goto closefd;
 		}
 		switch (kdhl.compression) {
@@ -710,7 +711,7 @@ DoFile(const char *savedir, int savedirfd, const char 
 			    device);
 
 		status = STATUS_BAD;
-		if (force == 0)
+		if (force == false)
 			goto closefd;
 
 		if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) {
@@ -727,7 +728,7 @@ DoFile(const char *savedir, int savedirfd, const char 
 			    dtoh32(kdhl.version), device);
 
 			status = STATUS_BAD;
-			if (force == 0)
+			if (force == false)
 				goto closefd;
 		}
 	}
@@ -741,7 +742,7 @@ DoFile(const char *savedir, int savedirfd, const char 
 		    "parity error on last dump header on %s", device);
 		nerr++;
 		status = STATUS_BAD;
-		if (force == 0)
+		if (force == false)
 			goto closefd;
 	}
 	dumpextent = dtoh64(kdhl.dumpextent);
@@ -772,7 +773,7 @@ DoFile(const char *savedir, int savedirfd, const char 
 		    "first and last dump headers disagree on %s", device);
 		nerr++;
 		status = STATUS_BAD;
-		if (force == 0)
+		if (force == false)
 			goto closefd;
 	} else {
 		status = STATUS_GOOD;
@@ -1110,7 +1111,8 @@ main(int argc, char **argv)
 	char **devs;
 	int i, ch, error, savedirfd;
 
-	checkfor = compress = clear = force = keep = verbose = 0;
+	checkfor = compress = clear = force = keep = false;
+	verbose = 0;
 	nfound = nsaved = nerr = 0;
 	savedir = ".";
 
@@ -1124,16 +1126,16 @@ main(int argc, char **argv)
 	while ((ch = getopt(argc, argv, "Ccfkm:vz")) != -1)
 		switch(ch) {
 		case 'C':
-			checkfor = 1;
+			checkfor = true;
 			break;
 		case 'c':
-			clear = 1;
+			clear = true;
 			break;
 		case 'f':
-			force = 1;
+			force = true;
 			break;
 		case 'k':
-			keep = 1;
+			keep = true;
 			break;
 		case 'm':
 			maxdumps = atoi(optarg);


More information about the svn-src-all mailing list