summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-04-22 05:24:05 +0000
committernicm <nicm@openbsd.org>2012-04-22 05:24:05 +0000
commit3435deaee73086611fe0a4d541da344519d9b0c3 (patch)
treee7f6fbf695e48641653450886f24b41041a8c872 /usr.bin/tmux/cmd.c
parentHandle partial keys properly by making sure the timer has actually (diff)
downloadwireguard-openbsd-3435deaee73086611fe0a4d541da344519d9b0c3.tar.xz
wireguard-openbsd-3435deaee73086611fe0a4d541da344519d9b0c3.zip
Fix printing commands with no arguments, from Benjamin Poirier.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r--usr.bin/tmux/cmd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 08744ed651e..5b9ba25de01 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.63 2012/03/03 08:31:18 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.64 2012/04/22 05:24:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -304,11 +304,10 @@ cmd_print(struct cmd *cmd, char *buf, size_t len)
if (off < len) {
used = args_print(cmd->args, buf + off, len - off);
if (used == 0)
- buf[off - 1] = '\0';
- else {
+ off--;
+ else
off += used;
- buf[off] = '\0';
- }
+ buf[off] = '\0';
}
return (off);
}