Sync OpenBSD patchset 1095:

Fix printing commands with no arguments, from Benjamin Poirier.
This commit is contained in:
Tiago Cunha 2012-04-24 16:18:35 +00:00
parent bdfbb52951
commit 31cf5314ee

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