From 244fca1ffa4b574714385c9d7ffb43e04df7ee0a Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Tue, 5 Aug 2003 13:35:17 +0000 Subject: [PATCH] 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 --- sbin/newfs/mkfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index ea576efd2676..80ed645569ea 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);