Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sbin/fdisk Pull up revision 1.42 (requested by itojun):



details:   https://anonhg.NetBSD.org/src/rev/085f9204c106
branches:  netbsd-1-5
changeset: 492776:085f9204c106
user:      he <he%NetBSD.org@localhost>
date:      Thu Feb 14 19:59:55 2002 +0000

description:
Pull up revision 1.42 (requested by itojun):
  When fetching the disk's hardware geometry, first attempt the
  DIOCGDEFLABEL ioctl, then fall back to the DIOCGDINFO ioctl.
  This ensures that we will get the actual hardware geometry info
  rather than any bogus info which might have been previously
  written to the disk's label area.

diffstat:

 sbin/fdisk/fdisk.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r f006d14d9d3a -r 085f9204c106 sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Thu Feb 14 19:57:10 2002 +0000
+++ b/sbin/fdisk/fdisk.c        Thu Feb 14 19:59:55 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdisk.c,v 1.41 2000/06/14 19:35:50 wiz Exp $ */
+/*     $NetBSD: fdisk.c,v 1.41.2.1 2002/02/14 19:59:55 he Exp $ */
 
 /*
  * Mach Operating System
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.41 2000/06/14 19:35:50 wiz Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.41.2.1 2002/02/14 19:59:55 he Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -1277,9 +1277,12 @@
 get_params()
 {
 
-       if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
-               warn("DIOCGDINFO");
-               return (-1);
+       if (ioctl(fd, DIOCGDEFLABEL, &disklabel) == -1) {
+               warn("DIOCGDEFLABEL");
+               if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
+                       warn("DIOCGDINFO");
+                       return (-1);
+               }
        }
 
        dos_cylinders = cylinders = disklabel.d_ncylinders;



Home | Main Index | Thread Index | Old Index