Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_ext2fs Instead of zerodivide, give a useful error ...



details:   https://anonhg.NetBSD.org/src/rev/bfa98447710e
branches:  trunk
changeset: 334731:bfa98447710e
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Dec 04 01:41:37 2014 +0000

description:
Instead of zerodivide, give a useful error message.

diffstat:

 sbin/fsck_ext2fs/setup.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r f0113eb07bda -r bfa98447710e sbin/fsck_ext2fs/setup.c
--- a/sbin/fsck_ext2fs/setup.c  Wed Dec 03 22:59:22 2014 +0000
+++ b/sbin/fsck_ext2fs/setup.c  Thu Dec 04 01:41:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setup.c,v 1.31 2013/06/23 02:06:04 dholland Exp $      */
+/*     $NetBSD: setup.c,v 1.32 2014/12/04 01:41:37 christos Exp $      */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -58,7 +58,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c    8.5 (Berkeley) 11/23/94";
 #else
-__RCSID("$NetBSD: setup.c,v 1.31 2013/06/23 02:06:04 dholland Exp $");
+__RCSID("$NetBSD: setup.c,v 1.32 2014/12/04 01:41:37 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -490,6 +490,10 @@
                    fstypenames[pp->p_fstype] : "unknown");
                return 0;
        }
+       if (pp->p_fsize == 0) {
+               pfatal("%s: PARTITION SIZE IS 0\n", dev);
+               return 0;
+       }
        memset(fs, 0, sizeof(struct m_ext2fs));
        fs->e2fs_bsize = pp->p_fsize;
        fs->e2fs.e2fs_log_bsize = pp->p_fsize / 1024;



Home | Main Index | Thread Index | Old Index