-/* $OpenBSD: fdisk.c,v 1.11 1997/01/27 21:57:36 rahnds Exp $ */
+/* $OpenBSD: fdisk.c,v 1.12 1997/01/31 11:59:05 deraadt Exp $ */
/* $NetBSD: fdisk.c,v 1.11 1995/10/04 23:11:19 ghudson Exp $ */
/*
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: fdisk.c,v 1.11 1997/01/27 21:57:36 rahnds Exp $";
+static char rcsid[] = "$OpenBSD: fdisk.c,v 1.12 1997/01/31 11:59:05 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
{
int cylinder, head;
- cylinder = sector / dos_cylindersectors;
+ if (dos_cylindersectors)
+ cylinder = sector / dos_cylindersectors;
+ else
+ cylinder = 0;
sector -= cylinder * dos_cylindersectors;
- head = sector / dos_sectors;
+ if (dos_sectors)
+ head = sector / dos_sectors;
+ else
+ head = 0;
sector -= head * dos_sectors;
*cylinderp = DOSCYL(cylinder);