mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-15 06:42:51 +01:00
fsck_ffs for pointers replace 0 with NULL.
Found with devel/coccinelle. Reviewed by: mckusick
This commit is contained in:
parent
6ba5a1d9ee
commit
7d5e656214
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297886
@ -702,7 +702,7 @@ static struct bufarea *
|
||||
getdirblk(ufs2_daddr_t blkno, long size)
|
||||
{
|
||||
|
||||
if (pdirbp != 0)
|
||||
if (pdirbp != NULL)
|
||||
pdirbp->b_flags &= ~B_INUSE;
|
||||
pdirbp = getdatablk(blkno, size, BT_DIRDATA);
|
||||
return (pdirbp);
|
||||
|
@ -184,7 +184,7 @@ bufinit(void)
|
||||
|
||||
pbp = pdirbp = (struct bufarea *)0;
|
||||
bufp = Malloc((unsigned int)sblock.fs_bsize);
|
||||
if (bufp == 0)
|
||||
if (bufp == NULL)
|
||||
errx(EEXIT, "cannot allocate buffer pool");
|
||||
cgblk.b_un.b_buf = bufp;
|
||||
initbarea(&cgblk, BT_CYLGRP);
|
||||
|
@ -290,7 +290,7 @@ ginode(ino_t inumber)
|
||||
if (startinum == 0 ||
|
||||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
|
||||
iblk = ino_to_fsba(&sblock, inumber);
|
||||
if (pbp != 0)
|
||||
if (pbp != NULL)
|
||||
pbp->b_flags &= ~B_INUSE;
|
||||
pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
|
||||
startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
|
||||
@ -608,7 +608,7 @@ pinode(ino_t ino)
|
||||
return;
|
||||
dp = ginode(ino);
|
||||
printf(" OWNER=");
|
||||
if ((pw = getpwuid((int)DIP(dp, di_uid))) != 0)
|
||||
if ((pw = getpwuid((int)DIP(dp, di_uid))) != NULL)
|
||||
printf("%s ", pw->pw_name);
|
||||
else
|
||||
printf("%u ", (unsigned)DIP(dp, di_uid));
|
||||
|
@ -349,7 +349,7 @@ checkfilesys(char *filesys)
|
||||
pfatal(
|
||||
"CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
|
||||
snapname, strerror(errno));
|
||||
} else if ((grp = getgrnam("operator")) == 0 ||
|
||||
} else if ((grp = getgrnam("operator")) == NULL ||
|
||||
mkdir(snapname, 0770) < 0 ||
|
||||
chown(snapname, -1, grp->gr_gid) < 0 ||
|
||||
chmod(snapname, 0770) < 0) {
|
||||
|
@ -151,7 +151,7 @@ pass1(void)
|
||||
*/
|
||||
inostathead[c].il_numalloced = inosused;
|
||||
if (inosused == 0) {
|
||||
inostathead[c].il_stat = 0;
|
||||
inostathead[c].il_stat = NULL;
|
||||
continue;
|
||||
}
|
||||
info = Calloc((unsigned)inosused, sizeof(struct inostat));
|
||||
@ -221,7 +221,7 @@ pass1(void)
|
||||
inostathead[c].il_numalloced = inosused;
|
||||
if (inosused == 0) {
|
||||
free(inostathead[c].il_stat);
|
||||
inostathead[c].il_stat = 0;
|
||||
inostathead[c].il_stat = NULL;
|
||||
continue;
|
||||
}
|
||||
info = Calloc((unsigned)inosused, sizeof(struct inostat));
|
||||
@ -500,9 +500,9 @@ pass1check(struct inodesc *idesc)
|
||||
return (STOP);
|
||||
}
|
||||
new->dup = blkno;
|
||||
if (muldup == 0) {
|
||||
if (muldup == NULL) {
|
||||
duplist = muldup = new;
|
||||
new->next = 0;
|
||||
new->next = NULL;
|
||||
} else {
|
||||
new->next = muldup->next;
|
||||
muldup->next = new;
|
||||
|
@ -108,7 +108,7 @@ pass1bcheck(struct inodesc *idesc)
|
||||
if (dlp == muldup)
|
||||
break;
|
||||
}
|
||||
if (muldup == 0 || duphead == muldup->next) {
|
||||
if (muldup == NULL || duphead == muldup->next) {
|
||||
rerun = 1;
|
||||
return (STOP);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ pass4check(struct inodesc *idesc)
|
||||
free((char *)dlp);
|
||||
break;
|
||||
}
|
||||
if (dlp == 0) {
|
||||
if (dlp == NULL) {
|
||||
clrbmap(blkno);
|
||||
n_blks--;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ pass5(void)
|
||||
}
|
||||
}
|
||||
if (fs->fs_maxcontig > 1) {
|
||||
const char *doit = 0;
|
||||
const char *doit = NULL;
|
||||
|
||||
if (fs->fs_contigsumsize < 1) {
|
||||
doit = "CREAT";
|
||||
|
@ -68,7 +68,7 @@ blockcheck(char *origname)
|
||||
newname = origname;
|
||||
if (stat(newname, &stblock) < 0) {
|
||||
cp = strrchr(newname, '/');
|
||||
if (cp == 0) {
|
||||
if (cp == NULL) {
|
||||
(void)snprintf(device, sizeof(device), "%s%s",
|
||||
_PATH_DEV, newname);
|
||||
newname = device;
|
||||
|
Loading…
Reference in New Issue
Block a user