Sync OpenBSD patchset 1095:

Fix printing commands with no arguments, from Benjamin Poirier.
pull/1/head
Tiago Cunha 2012-04-24 16:18:35 +00:00
parent bdfbb52951
commit 31cf5314ee
1 changed files with 3 additions and 4 deletions

7
cmd.c
View File

@ -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);
}