Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs If a disktype was specified, use the disktab info...



details:   https://anonhg.NetBSD.org/src/rev/023566578ba7
branches:  trunk
changeset: 556269:023566578ba7
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Dec 11 12:11:27 2003 +0000

description:
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:

 sbin/newfs/newfs.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (46 lines):

diff -r 3f4dfb9029e6 -r 023566578ba7 sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c        Thu Dec 11 11:29:17 2003 +0000
+++ b/sbin/newfs/newfs.c        Thu Dec 11 12:11:27 2003 +0000
@@ -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 @@
 #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 @@
 {
        static struct disklabel lab;
 
-       if (ioctl(fd, DIOCGDINFO, &lab) < 0) {
 #ifdef COMPAT
-               if (disktype) {
-                       struct disklabel *lp;
+       if (disktype) {
+               struct disklabel *lp;
 
-                       unlabeled++;
-                       lp = getdiskbyname(disktype);
-                       if (lp == NULL)
-                               errx(1, "%s: unknown disk type", disktype);
-                       return (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);
        }



Home | Main Index | Thread Index | Old Index