git: 9front

Download patch

ref: 75f91d450d2b946adbf03b8a465104901fde57ec
parent: 1ff9815b908d9be9bc852da8066ee4d888436f9f
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);
--