summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd/vmd.c
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2017-10-07 02:05:31 +0000
committermlarkin <mlarkin@openbsd.org>2017-10-07 02:05:31 +0000
commit2014be3f5610792af32d76affdb5d0b8c848698b (patch)
treecd163dd268d7d5e2239252c34205ac0a9aa572ba /usr.sbin/vmd/vmd.c
parentUnfortunately I removed too much in my previous commit and broke (diff)
downloadwireguard-openbsd-2014be3f5610792af32d76affdb5d0b8c848698b.tar.xz
wireguard-openbsd-2014be3f5610792af32d76affdb5d0b8c848698b.zip
vmd: retain ownership on vm reboot
from Jesper Wallin, thanks!
Diffstat (limited to 'usr.sbin/vmd/vmd.c')
-rw-r--r--usr.sbin/vmd/vmd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index f1abc54d9a3..28226e16d75 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.69 2017/09/08 06:24:31 mlarkin Exp $ */
+/* $OpenBSD: vmd.c,v 1.70 2017/10/07 02:05:31 mlarkin Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -413,7 +413,7 @@ vmd_dispatch_vmm(int fd, struct privsep_proc *p, struct imsg *imsg)
log_debug("%s: about to stop vm id %d with tty open",
__func__, vm->vm_vmid);
vm_stop(vm, 1);
- config_setvm(ps, vm, (uint32_t)-1, 0);
+ config_setvm(ps, vm, (uint32_t)-1, vm->vm_uid);
}
break;
case IMSG_VMDOP_GET_INFO_VM_DATA:
@@ -1061,9 +1061,10 @@ vm_stop(struct vmd_vm *vm, int keeptty)
close(vm->vm_kernel);
vm->vm_kernel = -1;
}
- vm->vm_uid = 0;
- if (!keeptty)
+ if (!keeptty) {
vm_closetty(vm);
+ vm->vm_uid = 0;
+ }
}
void