From 389eaef1047e69836f65ce99301d7a2589083581 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 7 Oct 2013 11:39:49 +0100 Subject: [PATCH] goaljobs: Forgot to close the .goaljobs-memory file! --- goaljobs.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/goaljobs.ml b/goaljobs.ml index f3d27b7..4e3c07b 100644 --- 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 -- 1.8.3.1