shithub: riscv

Download patch

ref: e1bc28d1ddaf6bcfb35ea302beefaf5df09aa342
parent: d3773c43550ee5ce00eb3760f1faf58897a224f7
author: ppatience0 <[email protected]>
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: