diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-03-15 18:00:12 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-03-15 18:00:12 +0000 |
commit | 41c91327ff3f69d093863d0345bc9077f6386d2a (patch) | |
tree | b0649f0b6047c75dd3018c3bbaa1a2f8ddd52778 /usr.sbin/vmctl | |
parent | 3f4288d46a948119dda164bee12a7ea12250b17f (diff) |
Print "-" if the tty name is empty.
Diffstat (limited to 'usr.sbin/vmctl')
-rw-r--r-- | usr.sbin/vmctl/vmctl.c | 6 |
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; |