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) {