summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2021-03-22 18:50:11 +0000
committerkn <kn@openbsd.org>2021-03-22 18:50:11 +0000
commit8b85f8f9360bb780725a2a7128db3858c944a56c (patch)
tree30582af0d15cb0f2ea617f1a2e70c3082aaa686f
parentUpdate device-tree bindings (diff)
downloadwireguard-openbsd-8b85f8f9360bb780725a2a7128db3858c944a56c.tar.xz
wireguard-openbsd-8b85f8f9360bb780725a2a7128db3858c944a56c.zip
Properly reflect stopping state
Diff from Preben Guldberg < preben at guldberg dot org>, thanks! In "vmctl status", VMs that are being stopped but are still running will simply show up as "running". Give preference to showing the "stopping" state akin to how a paused VM is handled. Tested by Dave Voutila OK tb
-rw-r--r--usr.sbin/vmctl/vmctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/vmctl/vmctl.c b/usr.sbin/vmctl/vmctl.c
index d8edbc062eb..8a8d153460b 100644
--- a/usr.sbin/vmctl/vmctl.c
+++ b/usr.sbin/vmctl/vmctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmctl.c,v 1.76 2021/01/27 07:21:12 deraadt Exp $ */
+/* $OpenBSD: vmctl.c,v 1.77 2021/03/22 18:50:11 kn Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
@@ -708,7 +708,7 @@ add_info(struct imsg *imsg, int *ret)
*
* Returns a string representing the current VM state, note that the order
* matters. A paused VM does have the VM_STATE_RUNNING bit set, but
- * VM_STATE_PAUSED is more significant to report.
+ * VM_STATE_PAUSED is more significant to report. Same goes for stopping VMs.
*
* Parameters
* vm_state: mask indicating the vm state
@@ -720,10 +720,10 @@ vm_state(unsigned int mask)
return "paused";
else if (mask & VM_STATE_WAITING)
return "waiting";
- else if (mask & VM_STATE_RUNNING)
- return "running";
else if (mask & VM_STATE_SHUTDOWN)
return "stopping";
+ else if (mask & VM_STATE_RUNNING)
+ return "running";
/* Presence of absence of other flags */
else if (!mask || (mask & VM_STATE_DISABLED))
return "stopped";