ref: ee68dedf53695895630fd9a463429a8d34a9679c
parent: a141f4c53a32d8227f9a490a8e4f7d87445c47d1
author: spew <devnull@localhost>
date: Sun May 1 16:34:07 EDT 2016
null terminate await buffer for proper tokenize call
--- a/sys/src/cmd/awk/run.c
+++ b/sys/src/cmd/awk/run.c
@@ -63,7 +63,7 @@
system(const char *s)
{
char status[512], *statfld[5];
- int w, pid;
+ int n, pid;
if(!s)
return 1; /* a command interpreter is available */
@@ -76,8 +76,9 @@
return -1;
}
for(;;) {
- w = await(status, sizeof(status) - 1);
- if(w == -1)
+ n = await(status, sizeof(status) - 1);
+ status[n] = '\0';
+ if(n == -1)
return -1;
tokenize(status, statfld, nelem(statfld));
if(strtol(statfld[0], nil, 0) == pid)