summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2004-10-25 23:36:51 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2004-10-25 23:36:51 +0000
commit535ffdbc660b8b657c65c70fcfaa750d7078e002 (patch)
treef7dcd1deb76e18b353088e219b55967105953993
parent8ddc001e1e39804dc0856af0447f1a165f6e3f45 (diff)
don't assume a block is allocated if bread() or cg_chkmagic() fails.
ok marius@ tedu@
-rw-r--r--sys/ufs/ffs/ffs_alloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 68a499cd040..4edc0274079 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.50 2004/09/18 22:01:18 tedu Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.51 2004/10/25 23:36:50 pedro Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -1588,16 +1588,16 @@ ffs_checkblk(ip, bno, size)
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, dtog(fs, bno))),
(int)fs->fs_cgsize, NOCRED, &bp);
if (error) {
- /* XXX - probably should panic here */
brelse(bp);
- return (-1);
+ return (0);
}
+
cgp = (struct cg *)bp->b_data;
if (!cg_chkmagic(cgp)) {
- /* XXX - probably should panic here */
brelse(bp);
- return (-1);
+ return (0);
}
+
bno = dtogd(fs, bno);
if (size == fs->fs_bsize) {
free = ffs_isblock(fs, cg_blksfree(cgp), fragstoblks(fs, bno));