Hi,
Stopping a VM owned by root as a non-root user fails with the following
error message:

  $ vmctl stop test
  vmctl: terminate vm command failed: Invalid argument

I think favoring warnc() with the appropriate errno number passed along
improves things. This of course is under the assumption that error codes
internal to vmd and errno:s are disjoint.

  $ ./obj/vmctl stop test 
  vmctl: terminate vm command failed: Operation not permitted

Comments? OK?

Index: vmctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/vmctl/vmctl.c,v
retrieving revision 1.49
diff -u -p -r1.49 vmctl.c
--- vmctl.c     19 Jun 2018 17:13:50 -0000      1.49
+++ vmctl.c     3 Jul 2018 08:46:25 -0000
@@ -465,7 +465,7 @@ terminate_vm_complete(struct imsg *imsg,
                                *ret = EIO;
                                break;
                        default:
-                               warn("terminate vm command failed");
+                               warnc(res, "terminate vm command failed");
                                *ret = EIO;
                        }
                } else {

Reply via email to