diff options
author | 2015-12-07 15:57:53 +0000 | |
---|---|---|
committer | 2015-12-07 15:57:53 +0000 | |
commit | f9b8861fcedb09c17122b0d247403cdd4418fd3d (patch) | |
tree | bedc938fc17a9290db556eefe5263ddbd3f496c6 | |
parent | Fix error handling in a few cases: some function return (-1) on error, (diff) | |
download | wireguard-openbsd-f9b8861fcedb09c17122b0d247403cdd4418fd3d.tar.xz wireguard-openbsd-f9b8861fcedb09c17122b0d247403cdd4418fd3d.zip |
Only increment the vm counter after successfully adding a new vm; the
counter has to be in sync in the parent and vmm processes. This fixes
reload after a previous load error.
-rw-r--r-- | usr.sbin/vmd/config.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c index b6b01795ece..06f2399ebdc 100644 --- a/usr.sbin/vmd/config.c +++ b/usr.sbin/vmd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.8 2015/12/07 14:43:24 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.9 2015/12/07 15:57:53 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -141,7 +141,7 @@ config_getvm(struct privsep *ps, struct vm_create_params *vcp, for (i = 0; i < vcp->vcp_nnics; i++) vm->vm_ifs[i] = -1; vm->vm_kernel = -1; - vm->vm_vmid = ++env->vmd_nvm; + vm->vm_vmid = env->vmd_nvm + 1; if (vm_getbyvmid(vm->vm_vmid) != NULL) fatalx("too many vms"); @@ -204,6 +204,7 @@ config_getvm(struct privsep *ps, struct vm_create_params *vcp, vcp, sizeof(*vcp)); } + env->vmd_nvm++; return (0); fail: |