newfs: useless/bogus check if new last block can be accessed?
iedowse at maths.tcd.ie
Fri May 9 19:02:40 PDT 2003
In message <20030509203228.A62797 at FreeBSD.org>, Juli Mallett writes:
>I at one point had some warnx calls (at minimum, since things tend to work
>and it's better to let someone shoot their foot maybe than use errx, cause
>at that point, it's a bit late.) and so on. I didn't ever get them into
>CVS as I was working on general libufs-ification at the time of newfs, and
>then tracking down why that broke things (*blush*), and I didn't want to
>put in too many new failure cases I could be blamed for :) Do a bunch of
The missing error checking appears to be a regression introduced
in revision 1.71 of mkfs.c; before that, any write failures in
wtfs() would cause newfs to output the sector number, the errno
string and then exit.
>(which went nowhere due to over-engineering, and too much faith...er, yeah,
>it went nowhere), one of the things I wanted to do was have a "naive" flag
>as part of an (undeveloped) generalised flags (external, not like MINE_)
>interface, which would let libufs do the exploding, if things went wrong.
Something like the patch below should do the trick for now. This
puts back the old exit code and sector number information, but
relies on the undocumented (?) behaviour of bwrite() leaving a
sensible value in errno.
RCS file: /dump/FreeBSD-CVS/src/sbin/newfs/mkfs.c,v
retrieving revision 1.75
diff -u -r1.75 mkfs.c
--- mkfs.c 3 May 2003 18:41:58 -0000 1.75
+++ mkfs.c 10 May 2003 01:56:39 -0000
@@ -849,7 +849,8 @@
- bwrite(&disk, bno, bf, size);
+ if (bwrite(&disk, bno, bf, size) < 0)
+ err(36, "wtfs: %d bytes at sector %jd", size, (intmax_t)bno);
More information about the freebsd-fs