git: 9front

Download patch

ref: 98f30d603e5bf0cab8b61aefa569a7ccc3f2be15
parent: 7c98952c90f39921395b3fe0813ed3a216149dee
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)
--