Date: Sat, 10 May 2003 03:02:37 +0100 From: Ian Dowse <iedowse@maths.tcd.ie> To: Juli Mallett <jmallett@FreeBSD.org> Cc: Lukas Ertl <l.ertl@univie.ac.at> Subject: Re: newfs: useless/bogus check if new last block can be accessed? Message-ID: <200305100302.aa28788@salmon.maths.tcd.ie> In-Reply-To: Your message of "Fri, 09 May 2003 20:32:29 CDT." <20030509203228.A62797@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030509203228.A62797@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. Ian Index: mkfs.c =================================================================== 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 @@ { if (Nflag) return; - bwrite(&disk, bno, bf, size); + if (bwrite(&disk, bno, bf, size) < 0) + err(36, "wtfs: %d bytes at sector %jd", size, (intmax_t)bno); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305100302.aa28788>