Skip to content
Snippets Groups Projects
Commit 389eaef1 authored by Richard W.M. Jones's avatar Richard W.M. Jones
Browse files

goaljobs: Forgot to close the .goaljobs-memory file!

parent a0b4f0aa
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment