Subject: fdisk -B
To: None <port-i386@netbsd.org>
From: Aymeric Vincent <xmimic@free.fr>
List: port-i386
Date: 07/09/2001 22:29:49
        Hi,

fdisk -B on a disk which has no NetBSD disklabel fails because it
can't read said disklabel.

However, it seems perfectly reasonable to install a different MBR on
any disk, whether it contains or not a NetBSD system. This proves
useful if your first disk is not NetBSD-aware.

The following patch should make this possible. Anyone cares if I
commit this? The NetBSD geometry will appear as 0/0/0 if there is no
disklabel but I believe it is not used while processing the -B
option. My main concern is: how come no one stumbled on this? Am I
missing something?

regards,
 Aymeric

Index: fdisk.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/fdisk/fdisk.c,v
retrieving revision 1.46
diff -u -r1.46 fdisk.c
--- fdisk.c	2001/04/16 10:47:15	1.46
+++ fdisk.c	2001/07/09 20:19:23
@@ -1258,7 +1258,7 @@
 		warnx("%s is not a character device or regular file", disk);
 		return (-1);
 	}
-	if (get_params() == -1) {
+	if (get_params() == -1 && !B_flag) {
 		close(fd);
 		return (-1);
 	}