From 33f84157854cc2a532e531fa79332d60c409ed41 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 20 May 2025 17:16:09 +0200 Subject: [PATCH] Fixup history file EINTR loop to actually loop Fixes d84e68dd4f (Retry history file flock() on EINTR, 2025-05-20). (cherry picked from commit 386716319344a0a1e1f6b0ff82af057e4f20cd36) --- src/history.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/history.rs b/src/history.rs index 1c6e9747a..040d20240 100644 --- a/src/history.rs +++ b/src/history.rs @@ -1355,12 +1355,12 @@ unsafe fn maybe_lock_file(file: &mut File, lock_type: libc::c_int) -> bool { let (ok, start_time) = loop { let start_time = SystemTime::now(); - if unsafe { flock(raw_fd, lock_type) } == -1 { - if errno::errno().0 != EINTR { - break (false, start_time); - } + if unsafe { flock(raw_fd, lock_type) } != -1 { + break (true, start_time); + } + if errno::errno().0 != EINTR { + break (false, start_time); } - break (true, start_time); }; if let Ok(duration) = start_time.elapsed() { if duration > Duration::from_millis(250) {