shithub: riscv

Download patch

ref: ce7f7d3ab9f193dc35ee005487b83c5a93b963d9
parent: b6b5fd6da79aff13f7ebded1ae49124743411271
author: cinap_lenrek <[email protected]>
date: Mon May 16 14:03:57 EDT 2016

rc: fix double close() in addenv()

--- a/sys/src/cmd/rc/plan9.c
+++ b/sys/src/cmd/rc/plan9.c
@@ -273,12 +273,10 @@
 		if((f = Creat(envname))<0)
 			pfmt(err, "rc: can't open %s: %r\n", envname);
 		else{
-			if(v->fn){
-				fd = openfd(f);
+			fd = openfd(f);
+			if(v->fn)
 				pfmt(fd, "fn %q %s\n", v->name, v->fn[v->pc-1].s);
-				closeio(fd);
-			}
-			close(f);
+			closeio(fd);
 		}
 	}
 }