shithub: mc

Download patch

ref: 5cf5b36ecee04cbb03bffaa26c6e74d66248df59
parent: 3ecd3ce8929a1eb9a3632b7e4d85769d72babc9a
author: Ori Bernstein <[email protected]>
date: Thu Jan 1 09:46:59 EST 2015

Get the length of the env var right.

--- a/libstd/env+plan9.myr
+++ b/libstd/env+plan9.myr
@@ -32,11 +32,13 @@
 
 const getenv = {name
 	var buf : byte[128]
+	var n
+
 	match envfind(name)
 	| `Some val:	-> `Some val
 	| `None:
-		bfmt(buf[:], "/env/%s", name)
-		match std.slurp(buf[:])
+		n = bfmt(buf[:], "/env/%s", name)
+		match std.slurp(buf[:n])
 		| `Fail m: -> `None
 		| `Ok data:
 			slpush(envkey, sldup(name))