aboutsummaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-04-24 16:18:35 +0000
committerTiago Cunha <tcunha@gmx.com>2012-04-24 16:18:35 +0000
commit31cf5314ee56931f0279008ac00cca3aaa54f6f0 (patch)
treec63c98f91b6b9b023e2932378f78689b068f6a82 /cmd.c
parentbdfbb5295169ee1b9341a0ef8f0f80185f1191db (diff)
downloadrtmux-31cf5314ee56931f0279008ac00cca3aaa54f6f0.tar.gz
rtmux-31cf5314ee56931f0279008ac00cca3aaa54f6f0.tar.bz2
rtmux-31cf5314ee56931f0279008ac00cca3aaa54f6f0.zip
Sync OpenBSD patchset 1095:
Fix printing commands with no arguments, from Benjamin Poirier.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd.c b/cmd.c
index 2763a603..f231b230 100644
--- a/cmd.c
+++ b/cmd.c
@@ -303,11 +303,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);
}