diff options
author | dv <dv@cvs.openbsd.org> | 2021-04-05 11:35:27 +0000 |
---|---|---|
committer | dv <dv@cvs.openbsd.org> | 2021-04-05 11:35:27 +0000 |
commit | b0cb11cb21645e8634268d9d96a779bb95de12f6 (patch) | |
tree | 77c320341e015fbdc7b11b1c4ec01d6e78049424 | |
parent | 54bed05173499e168824ca272e9352d871a13a7e (diff) |
Send correct response type on unpause errors.
ok pd@
-rw-r--r-- | usr.sbin/vmd/vmd.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index cd585d5a197..c9bcbb16833 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.121 2021/03/29 23:37:01 dv Exp $ */ +/* $OpenBSD: vmd.c,v 1.122 2021/04/05 11:35:26 dv Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -203,20 +203,26 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg) if (vid.vid_id == 0) { if ((vm = vm_getbyname(vid.vid_name)) == NULL) { res = ENOENT; - cmd = IMSG_VMDOP_PAUSE_VM_RESPONSE; + cmd = imsg->hdr.type == IMSG_VMDOP_PAUSE_VM + ? IMSG_VMDOP_PAUSE_VM_RESPONSE + : IMSG_VMDOP_UNPAUSE_VM_RESPONSE; break; } else { vid.vid_id = vm->vm_vmid; } } else if ((vm = vm_getbyid(vid.vid_id)) == NULL) { res = ENOENT; - cmd = IMSG_VMDOP_PAUSE_VM_RESPONSE; + cmd = imsg->hdr.type == IMSG_VMDOP_PAUSE_VM + ? IMSG_VMDOP_PAUSE_VM_RESPONSE + : IMSG_VMDOP_UNPAUSE_VM_RESPONSE; break; } if (vm_checkperm(vm, &vm->vm_params.vmc_owner, vid.vid_uid) != 0) { res = EPERM; - cmd = IMSG_VMDOP_PAUSE_VM_RESPONSE; + cmd = imsg->hdr.type == IMSG_VMDOP_PAUSE_VM + ? IMSG_VMDOP_PAUSE_VM_RESPONSE + : IMSG_VMDOP_UNPAUSE_VM_RESPONSE; break; } proc_compose_imsg(ps, PROC_VMM, -1, imsg->hdr.type, |