summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorppatience0 <ppatience0@gmail.com>2013-06-01 19:40:38 -0400
committerppatience0 <ppatience0@gmail.com>2013-06-01 19:40:38 -0400
commite1bc28d1ddaf6bcfb35ea302beefaf5df09aa342 (patch)
treed141f421c16a8d859877430318058095b8040f29
parentd3773c43550ee5ce00eb3760f1faf58897a224f7 (diff)
downloadplan9front-e1bc28d1ddaf6bcfb35ea302beefaf5df09aa342.tar.xz
fgui: check if fd is valid before entering new key
-rw-r--r--sys/src/cmd/auth/factotum/fgui.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/cmd/auth/factotum/fgui.c b/sys/src/cmd/auth/factotum/fgui.c
index f4a9f2826..ce372e864 100644
--- a/sys/src/cmd/auth/factotum/fgui.c
+++ b/sys/src/cmd/auth/factotum/fgui.c
@@ -792,10 +792,12 @@ needkey(Request *r)
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: