shithub: riscv

Download patch

ref: b540a22eb0c287398e21358d6b66c8e544001f77
parent: 2a6fd6ec25c66e87dd0127651549a2f8585c751f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Aug 4 07:48:19 EDT 2016

libauth: fix mount file-descriptor leak in auth_chuid()

--- a/sys/src/libauth/auth_chuid.c
+++ b/sys/src/libauth/auth_chuid.c
@@ -30,8 +30,10 @@
 
 	/* get a link to factotum as new user */
 	fd = open("/srv/factotum", ORDWR);
-	if(fd >= 0)
+	if(fd >= 0){
 		mount(fd, -1, "/mnt", MREPL, "");
+		close(fd);
+	}
 
 	/* set up new namespace */
 	return newns(ai->cuid, ns);