From ce7f7d3ab9f193dc35ee005487b83c5a93b963d9 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 16 May 2016 18:03:57 +0200 Subject: [PATCH] rc: fix double close() in addenv() --- sys/src/cmd/rc/plan9.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/src/cmd/rc/plan9.c b/sys/src/cmd/rc/plan9.c index 412e6957d..a9dcdddfe 100644 --- a/sys/src/cmd/rc/plan9.c +++ b/sys/src/cmd/rc/plan9.c @@ -273,12 +273,10 @@ addenv(var *v) 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); } } }