summaryrefslogtreecommitdiffstats
path: root/sbin/newfs
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2003-08-05 13:35:17 +0000
committeryar <yar@FreeBSD.org>2003-08-05 13:35:17 +0000
commit6750c552fbd053be3a5d71013df548cb5a4796c7 (patch)
tree5800ebafff4e8b0dde7277b7386923e6293c93e5 /sbin/newfs
parent8ec20dfab30c700b6510b185fedfb7563ee8cfa1 (diff)
downloadFreeBSD-src-6750c552fbd053be3a5d71013df548cb5a4796c7.zip
FreeBSD-src-6750c552fbd053be3a5d71013df548cb5a4796c7.tar.gz
Exit with a non-zero status upon a block allocation failure.
The old way of just returning could result in a file system extremely likely to panic the kernel. The warning printed wouldn't help much since tools invoking newfs(8), e.g., mdmfs(8), couldn't detect the error. PR: bin/55078 MFC after: 1 week
Diffstat (limited to 'sbin/newfs')
-rw-r--r--sbin/newfs/mkfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index ea576ef..80ed645 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -789,17 +789,17 @@ alloc(int size, int mode)
sblock.fs_cgsize);
if (acg.cg_magic != CG_MAGIC) {
printf("cg 0: bad magic number\n");
- return (0);
+ exit(38);
}
if (acg.cg_cs.cs_nbfree == 0) {
printf("first cylinder group ran out of space\n");
- return (0);
+ exit(39);
}
for (d = 0; d < acg.cg_ndblk; d += sblock.fs_frag)
if (isblock(&sblock, cg_blksfree(&acg), d / sblock.fs_frag))
goto goth;
printf("internal error: can't find block in cyl 0\n");
- return (0);
+ exit(40);
goth:
blkno = fragstoblks(&sblock, d);
clrblock(&sblock, cg_blksfree(&acg), blkno);
OpenPOWER on IntegriCloud