diff options
author | phk <phk@FreeBSD.org> | 1998-03-04 18:03:54 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1998-03-04 18:03:54 +0000 |
commit | 3acc203e1d251c265f838b5e5a56585d0a15b067 (patch) | |
tree | 6311afc418b3c32260186d2dbe62a01aa304c13f /sbin/fsck_ffs | |
parent | 6f03785e6944a35d92c63f95f2af718dc1b703aa (diff) | |
download | FreeBSD-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_ffs')
-rw-r--r-- | sbin/fsck_ffs/setup.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 197d9cc..28e7e4b 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/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, |