From d3857d0bd2419fbeb5365d0e69d3c603ce64d3d4 Mon Sep 17 00:00:00 2001 From: reinoud Date: Wed, 14 Dec 2005 15:01:03 +0000 Subject: [PATCH] Fix disklabel recognition code for mbr based systems like i386. It would return NULL even though no disklabel was found making callers assume that a valid disklabel WAS found but instead were presented by the dummy disklabel that is created. If the rval is SCAN_CONTINUE it now returns a standard error that no disklabel was found instead of the NULL. --- sys/kern/subr_disk_mbr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_disk_mbr.c b/sys/kern/subr_disk_mbr.c index 72c702fda09a..ebb17397129f 100644 --- a/sys/kern/subr_disk_mbr.c +++ b/sys/kern/subr_disk_mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_disk_mbr.c,v 1.7 2005/12/11 12:24:30 christos Exp $ */ +/* $NetBSD: subr_disk_mbr.c,v 1.8 2005/12/14 15:01:03 reinoud Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.7 2005/12/11 12:24:30 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.8 2005/12/14 15:01:03 reinoud Exp $"); #include #include @@ -297,9 +297,11 @@ readdisklabel(dev, strat, lp, osdep) } brelse(a.bp); - if (rval != SCAN_ERROR) - return NULL; - return a.msg; + if (rval == SCAN_CONTINUE) + return "No disclabel found"; + if (rval == SCAN_ERROR) + return a.msg; /* XXX returning stack string */ + return NULL; } static int