From f9763e12f94d129b6f22ee3c03f25b76609ec289 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 28 Sep 2020 09:16:53 +0200 Subject: [PATCH] simplify open_file_locked --- proxmox/src/tools/fs.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/proxmox/src/tools/fs.rs b/proxmox/src/tools/fs.rs index 3f96d9ed..5c599106 100644 --- a/proxmox/src/tools/fs.rs +++ b/proxmox/src/tools/fs.rs @@ -514,19 +514,9 @@ pub fn lock_file( Ok(()) } -/// Open or create a lock file (append mode). Then try to -/// acquire a shared lock using `lock_file()`. -pub fn open_file_locked_shared>(path: P, timeout: Duration) -> Result { - open_file_locked_impl(path, timeout, false) -} - /// Open or create a lock file (append mode). Then try to /// acquire a lock using `lock_file()`. -pub fn open_file_locked>(path: P, timeout: Duration) -> Result { - open_file_locked_impl(path, timeout, true) -} - -fn open_file_locked_impl>(path: P, timeout: Duration, exclusive: bool) -> Result { +pub fn open_file_locked>(path: P, timeout: Duration, exclusive: bool) -> Result { let path = path.as_ref(); let mut file = match OpenOptions::new().create(true).append(true).open(path) {