Source-Changes-HG archive

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

[src/trunk]: src/sbin/disklabel Don't error out if the mbr cannot be read.



details:   https://anonhg.NetBSD.org/src/rev/7ac80109778d
branches:  trunk
changeset: 507690:7ac80109778d
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Mar 29 12:18:32 2001 +0000

description:
Don't error out if the mbr cannot be read.
This makes "disklabel cd0" working also on platforms with MBR support.

diffstat:

 sbin/disklabel/disklabel.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r b9e533a6eb9c -r 7ac80109778d sbin/disklabel/disklabel.c
--- a/sbin/disklabel/disklabel.c        Thu Mar 29 10:51:16 2001 +0000
+++ b/sbin/disklabel/disklabel.c        Thu Mar 29 12:18:32 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.96 2001/02/19 22:56:18 cgd Exp $       */
+/*     $NetBSD: disklabel.c,v 1.97 2001/03/29 12:18:32 drochner Exp $  */
 
 /*
  * Copyright (c) 1987, 1993
@@ -47,7 +47,7 @@
 static char sccsid[] = "@(#)disklabel.c        8.4 (Berkeley) 5/4/95";
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #else
-__RCSID("$NetBSD: disklabel.c,v 1.96 2001/02/19 22:56:18 cgd Exp $");
+__RCSID("$NetBSD: disklabel.c,v 1.97 2001/03/29 12:18:32 drochner Exp $");
 #endif
 #endif /* not lint */
 
@@ -642,8 +642,10 @@
 
        dp = (struct mbr_partition *)&mbr[MBR_PARTOFF];
        if (lseek(f, (off_t)MBR_BBSECTOR * DEV_BSIZE, SEEK_SET) < 0 ||
-           read(f, mbr, sizeof(mbr)) != sizeof(mbr))
-               err(4, "can't read master boot record");
+           read(f, mbr, sizeof(mbr)) != sizeof(mbr)) {
+               warn("can't read master boot record");
+               return (0);
+       }
 
 #if !defined(__i386__)
        /* avoid alignment error */



Home | Main Index | Thread Index | Old Index