summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2017-03-15 18:00:11 +0000
committerreyk <reyk@openbsd.org>2017-03-15 18:00:11 +0000
commited2fe5047f291a47adbd37b6d5a1c765edf75abb (patch)
tree2ffc20b11c077c8399ad64d28a538b36b04d65ec
parentClose the tty if the VM was powered down. (diff)
downloadwireguard-openbsd-ed2fe5047f291a47adbd37b6d5a1c765edf75abb.tar.xz
wireguard-openbsd-ed2fe5047f291a47adbd37b6d5a1c765edf75abb.zip
Print "-" if the tty name is empty.
-rw-r--r--usr.sbin/vmctl/vmctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/vmctl/vmctl.c b/usr.sbin/vmctl/vmctl.c
index bb61275ae1a..28d2e8d94a1 100644
--- a/usr.sbin/vmctl/vmctl.c
+++ b/usr.sbin/vmctl/vmctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmctl.c,v 1.26 2017/03/03 09:12:40 reyk Exp $ */
+/* $OpenBSD: vmctl.c,v 1.27 2017/03/15 18:00:11 reyk Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
@@ -409,8 +409,10 @@ print_vm_info(struct vmop_info_result *list, size_t ct)
maxmem);
if (vir->vir_id != 0) {
+ if (*vmi->vir_ttyname == '\0')
+ tty = "-";
/* get tty - skip /dev/ path */
- if ((tty = strrchr(vmi->vir_ttyname,
+ else if ((tty = strrchr(vmi->vir_ttyname,
'/')) == NULL || ++tty == '\0')
tty = list[i].vir_ttyname;