summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2003-12-11 12:11:27 +0000
committerdrochner <drochner@NetBSD.org>2003-12-11 12:11:27 +0000
commit7dcd19bbcebbce4f8a7cf2ea08ad15c791ddac07 (patch)
tree969f3e0ffd096e895a3cdb6172892bf6071fac9b /sbin
parent774cb2d93ef706ec0cca316980aa319846103f12 (diff)
If a disktype was specified, use the disktab information
and don't try the disklabel. Allows to create a filesystem on a floppy again. (It is arguably another bug that DIOCGDINFO returns nonsense for floppies.)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs/newfs.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index b3a66d16833..62b91cff982 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: newfs.c,v 1.76 2003/11/01 18:42:00 wiz Exp $ */
+/* $NetBSD: newfs.c,v 1.77 2003/12/11 12:11:27 drochner Exp $ */
/*
* Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: newfs.c,v 1.76 2003/11/01 18:42:00 wiz Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.77 2003/12/11 12:11:27 drochner Exp $");
#endif
#endif /* not lint */
@@ -686,18 +686,18 @@ getdisklabel(char *s, int fd)
{
static struct disklabel lab;
- if (ioctl(fd, DIOCGDINFO, &lab) < 0) {
#ifdef COMPAT
- if (disktype) {
- struct disklabel *lp;
-
- unlabeled++;
- lp = getdiskbyname(disktype);
- if (lp == NULL)
- errx(1, "%s: unknown disk type", disktype);
- return (lp);
- }
+ if (disktype) {
+ struct disklabel *lp;
+
+ unlabeled++;
+ lp = getdiskbyname(disktype);
+ if (lp == NULL)
+ errx(1, "%s: unknown disk type", disktype);
+ return (lp);
+ }
#endif
+ if (ioctl(fd, DIOCGDINFO, &lab) < 0) {
warn("ioctl (GDINFO)");
errx(1, lmsg, s);
}