diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-03-26 18:32:40 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-03-26 18:32:40 +0000 |
commit | 7200d40dd2027de48fec7bb01e9e831b96883579 (patch) | |
tree | ea1ea6455938f1a48474e85ce72e5632a20179e5 /usr.sbin/vmd | |
parent | 1bbc85e8a726b2c3d8cfa9e189b71e6a7d982b2d (diff) |
Don't compare kernel and root disk name if both strings are empty.
This avoids jumping into vmboot in some edge conditions.
OK mlarkin@
Diffstat (limited to 'usr.sbin/vmd')
-rw-r--r-- | usr.sbin/vmd/config.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c index 0adf62dfb02..05c3bfc1dab 100644 --- a/usr.sbin/vmd/config.c +++ b/usr.sbin/vmd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.28 2017/03/26 00:46:00 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.29 2017/03/26 18:32:39 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -160,17 +160,17 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, uint32_t peerid, uid_t uid) vm->vm_peerid = peerid; vm->vm_uid = uid; - /* Boot ELF kernel from disk image if path matches the root disk */ - if (vcp->vcp_ndisks && - strcmp(vcp->vcp_kernel, vcp->vcp_disks[0]) == 0) - vmboot = 1; - - /* Open external kernel for child */ - if (strlen(vcp->vcp_kernel) && !vmboot && - (kernfd = open(vcp->vcp_kernel, O_RDONLY)) == -1) { - log_warn("%s: can't open kernel/BIOS boot image %s", - __func__, vcp->vcp_kernel); - goto fail; + if (strlen(vcp->vcp_kernel)) { + /* Boot kernel from disk image if path matches the root disk */ + if (vcp->vcp_ndisks && + strcmp(vcp->vcp_kernel, vcp->vcp_disks[0]) == 0) + vmboot = 1; + /* Open external kernel for child */ + else if ((kernfd = open(vcp->vcp_kernel, O_RDONLY)) == -1) { + log_warn("%s: can't open kernel/BIOS boot image %s", + __func__, vcp->vcp_kernel); + goto fail; + } } /* |