git.annexia.org
/
goaljobs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0b4f0a
)
goaljobs: Forgot to close the .goaljobs-memory file!
author
Richard W.M. Jones
<rjones@redhat.com>
Mon, 7 Oct 2013 10:39:49 +0000
(11:39 +0100)
committer
Richard W.M. Jones
<rjones@redhat.com>
Mon, 7 Oct 2013 10:39:49 +0000
(11:39 +0100)
goaljobs.ml
patch
|
blob
|
history
diff --git
a/goaljobs.ml
b/goaljobs.ml
index
f3d27b7
..
4e3c07b
100644
(file)
--- a/
goaljobs.ml
+++ b/
goaljobs.ml
@@
-340,6
+340,7
@@
let with_memory_locked ?(write = false) f =
let filename = getenv "HOME" // ".goaljobs-memory" in
let fd = openfile filename [O_RDWR; O_CREAT] 0o644 in
lockf fd (if write then F_LOCK else F_RLOCK) 0;
+
(* If the file is newly created with zero size, write an
* empty hash table.
*)
@@
-354,6
+355,7
@@
let with_memory_locked ?(write = false) f =
(* Run the function. *)
let r = try Either (f fd) with exn -> Or exn in
lockf fd F_ULOCK 0;
+ close fd;
match r with
| Either x -> x
| Or exn -> raise exn