Skip to content

Commit

Permalink
Convert flags from int to bool. Some (compress) were already used in
Browse files Browse the repository at this point in the history
comparisons with bool values.  No functional changes.
  • Loading branch information
glebius committed Oct 29, 2020
1 parent 638000c commit 0de9332
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions sbin/savecore/savecore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -676,7 +677,7 @@ DoFile(const char *savedir, int savedirfd, const char *device)
dtoh32(kdhl.version), device);

status = STATUS_BAD;
if (force == 0)
if (force == false)
goto closefd;
}
} else if (compare_magic(&kdhl, KERNELDUMPMAGIC)) {
Expand All @@ -686,7 +687,7 @@ DoFile(const char *savedir, int savedirfd, const char *device)
dtoh32(kdhl.version), device);

status = STATUS_BAD;
if (force == 0)
if (force == false)
goto closefd;
}
switch (kdhl.compression) {
Expand All @@ -710,7 +711,7 @@ DoFile(const char *savedir, int savedirfd, const char *device)
device);

status = STATUS_BAD;
if (force == 0)
if (force == false)
goto closefd;

if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) {
Expand All @@ -727,7 +728,7 @@ DoFile(const char *savedir, int savedirfd, const char *device)
dtoh32(kdhl.version), device);

status = STATUS_BAD;
if (force == 0)
if (force == false)
goto closefd;
}
}
Expand All @@ -741,7 +742,7 @@ DoFile(const char *savedir, int savedirfd, const char *device)
"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);
Expand Down Expand Up @@ -772,7 +773,7 @@ DoFile(const char *savedir, int savedirfd, const char *device)
"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;
Expand Down Expand Up @@ -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 = ".";

Expand All @@ -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);
Expand Down

0 comments on commit 0de9332

Please sign in to comment.