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.
This commit is contained in:
reinoud 2005-12-14 15:01:03 +00:00
parent 5dd44bf55a
commit d3857d0bd2
1 changed files with 7 additions and 5 deletions

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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