Ensure sector size is zero in the debug case, to avoid a division by zero

error pointed out by Zafer Aydogan.
This commit is contained in:
perseant 2006-08-06 00:21:14 +00:00
parent f4bbda4f6c
commit fb882cd53a
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: newfs.c,v 1.21 2006/08/06 00:14:17 perseant Exp $ */
/* $NetBSD: newfs.c,v 1.22 2006/08/06 00:21:14 perseant Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)newfs.c 8.5 (Berkeley) 5/24/95";
#else
__RCSID("$NetBSD: newfs.c,v 1.21 2006/08/06 00:14:17 perseant Exp $");
__RCSID("$NetBSD: newfs.c,v 1.22 2006/08/06 00:21:14 perseant Exp $");
#endif
#endif /* not lint */
@ -297,6 +297,9 @@ main(int argc, char **argv)
if (debug) {
lp = debug_readlabel(fsi);
pp = &lp->d_partitions[0];
if (secsize == 0)
secsize = 512;
pp->p_size = st.st_size / secsize;
} else {
static struct partition dummy_pp;
lp = NULL;