commit 1285618d7088fb83680b16a11b8bb2cc04d3e637
parent a7fbf8277d10a3e7c229f46f56cb0101687e614d
Author: Kris Maglione <jg@suckless.org>
Date: Sat, 17 Feb 2007 00:19:24 -0500
Fix exit status and segfault in ixpc xwrite
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ixpc.c b/ixpc.c
@@ -281,13 +281,14 @@ main(int argc, char *argv[]) {
else if(!strncmp(cmd, "write", 6))
ret = xwrite(file, IXP_OWRITE);
else if(!strncmp(cmd, "xwrite", 7)) {
- ixp_strlcat(buffer, argv[i++], 1023);
+ if(i < argc)
+ ixp_strlcat(buffer, argv[i++], 1023);
while(i < argc) {
ixp_strlcat(buffer, " ", 1024);
if(ixp_strlcat(buffer, argv[i++], 1024) > 1023)
break;
}
- xawrite(file, IXP_OWRITE);
+ ret = xawrite(file, IXP_OWRITE);
}else {
Usage:
ixp_eprint("usage: ixpc [-a <address>] {create | read | ls [-l] | remove | write} <file>\n"