Fix test for active root partition when booting from a wedge
This commit is contained in:
parent
fd70b7a6af
commit
5864e121ba
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disks.c,v 1.22 2018/11/08 20:29:37 martin Exp $ */
|
||||
/* $NetBSD: disks.c,v 1.23 2018/11/09 15:20:36 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
@ -619,7 +619,8 @@ get_disks_helper(void *arg, const char *dev)
|
||||
* Exclude a disk mounted as root partition,
|
||||
* in case of install-image on a USB memstick.
|
||||
*/
|
||||
if (is_active_rootpart(state->dd->dd_name, 0))
|
||||
if (is_active_rootpart(state->dd->dd_name,
|
||||
state->dd->dd_no_part ? -1 : 0))
|
||||
return true;
|
||||
|
||||
if (!state->dd->dd_no_part) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: target.c,v 1.3 2015/10/18 09:21:55 martin Exp $ */
|
||||
/* $NetBSD: target.c,v 1.4 2018/11/09 15:20:36 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Jonathan Stone
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: target.c,v 1.3 2015/10/18 09:21:55 martin Exp $");
|
||||
__RCSID("$NetBSD: target.c,v 1.4 2018/11/09 15:20:36 martin Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -186,8 +186,12 @@ is_active_rootpart(const char *dev, int ptn)
|
||||
if (strcmp(dev, rootdev) != 0)
|
||||
return 0;
|
||||
|
||||
if (ptn < 0)
|
||||
return 1; /* device only check, or wedge */
|
||||
|
||||
mib[1] = KERN_ROOT_PARTITION;
|
||||
varlen = sizeof rootptn;
|
||||
rootptn = -1;
|
||||
if (sysctl(mib, 2, &rootptn, &varlen, NULL, 0) < 0)
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user