summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ifs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-03-04 18:03:54 +0000
committerphk <phk@FreeBSD.org>1998-03-04 18:03:54 +0000
commit3acc203e1d251c265f838b5e5a56585d0a15b067 (patch)
tree6311afc418b3c32260186d2dbe62a01aa304c13f /sbin/fsck_ifs
parent6f03785e6944a35d92c63f95f2af718dc1b703aa (diff)
downloadFreeBSD-src-3acc203e1d251c265f838b5e5a56585d0a15b067.zip
FreeBSD-src-3acc203e1d251c265f838b5e5a56585d0a15b067.tar.gz
If numdirs is zero, print a helpful message instead of divding by zero later.
Diffstat (limited to 'sbin/fsck_ifs')
-rw-r--r--sbin/fsck_ifs/setup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/fsck_ifs/setup.c b/sbin/fsck_ifs/setup.c
index 197d9cc..28e7e4b 100644
--- a/sbin/fsck_ifs/setup.c
+++ b/sbin/fsck_ifs/setup.c
@@ -295,6 +295,10 @@ setup(dev)
goto badsb;
}
numdirs = sblock.fs_cstotal.cs_ndir;
+ if (numdirs == 0) {
+ printf("numdirs is zero, try using an alternate superblock\n");
+ goto badsb;
+ }
inplast = 0;
listmax = numdirs + 10;
inpsort = (struct inoinfo **)calloc((unsigned)listmax,
OpenPOWER on IntegriCloud