shithub: mc

Download patch

ref: 93693aa92f138cb893f5ce41ee95b34f10fcdb71
parent: ecff997d01c7a7c5c74a08fda15dc2fedcc8a0af
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))