changeset 282:90db3ae63a17

disk_env: Implement correct semantics for lock()
author Lewin Bormann <lbo@spheniscida.de>
date Mon, 25 Sep 2017 20:31:27 +0200
parents fe30cd47b37d
children e338f6ad2353
files src/disk_env.rs
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/disk_env.rs	Mon Sep 25 20:30:46 2017 +0200
+++ b/src/disk_env.rs	Mon Sep 25 20:31:27 2017 +0200
@@ -99,7 +99,7 @@
         if locks.contains_key(&p.to_str().unwrap().to_string()) {
             Err(Status::new(StatusCode::AlreadyExists, "Lock is held"))
         } else {
-            let f = try!(fs::OpenOptions::new().write(true).open(p));
+            let f = try!(fs::OpenOptions::new().write(true).create(true).open(p));
 
             let flock_arg = libc::flock {
                 l_type: F_WRLCK,