git: 9front

Download patch

ref: 562eb62085e13831c8075ec9ded30aac7cc61123
parent: 666eaee06a9d0353666e24b4e5cf31163d987c69
author: ppatience0 <ppatience0@gmail.com>
date: Sat Jun 1 15:40:38 EDT 2013

fgui: check if fd is valid before entering new key

--- a/sys/src/cmd/auth/factotum/fgui.c
+++ b/sys/src/cmd/auth/factotum/fgui.c
@@ -792,10 +792,12 @@
 		entry[i].a->type = AttrNameval;
 	}
 
-	/* enter the new key !!!!need to do something in case of error!!!! */
+	/* enter the new key */
 	fd = open("/mnt/factotum/ctl", OWRITE);
-	fprint(fd, "key %A", r->a);
-	close(fd);
+	if(fd >= 0){
+		fprint(fd, "key %A", r->a);
+		close(fd);
+	}
 
 	teardownneedkey(r);
 out:
--