From 35ee5e661faa6bfca21a16966fe20545330e8830 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 9 Oct 2024 14:31:46 +0200 Subject: [PATCH] history: rename target_fd_after to target_file_after This was forgotten in decf99f71 (Use `File` instead of `OwnedFd` in a few places (#10355), 2024-03-17). --- src/history.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/history.rs b/src/history.rs index d00149665..2c8235913 100644 --- a/src/history.rs +++ b/src/history.rs @@ -693,15 +693,15 @@ impl HistoryImpl { // If the open fails, then proceed; this may be because there is no current history let mut new_file_id = INVALID_FILE_ID; - let mut target_fd_after = wopen_cloexec(&target_name, OFlag::O_RDONLY, Mode::empty()); - if let Ok(target_fd_after) = target_fd_after.as_mut() { + let mut target_file_after = wopen_cloexec(&target_name, OFlag::O_RDONLY, Mode::empty()); + if let Ok(target_file_after) = target_file_after.as_mut() { // critical to take the lock before checking file IDs, // and hold it until after we are done replacing. // Also critical to check the file at the path, NOT based on our fd. // It's only OK to replace the file while holding the lock. - // Note any lock is released when target_fd_after is closed. + // Note any lock is released when target_file_after is closed. unsafe { - Self::maybe_lock_file(target_fd_after, LOCK_EX); + Self::maybe_lock_file(target_file_after, LOCK_EX); } new_file_id = match file_id_for_path_or_error(&target_name) { Ok(file_id) => file_id, @@ -741,8 +741,8 @@ impl HistoryImpl { // corresponds to e.g. someone running sudo -E as the very first command. If they // did, it would be tricky to set the permissions correctly. (bash doesn't get this // case right either). - if let Ok(target_fd_after) = target_fd_after.as_ref() { - if let Ok(md) = fstat(target_fd_after.as_raw_fd()) { + if let Ok(target_file_after) = target_file_after.as_ref() { + if let Ok(md) = fstat(target_file_after.as_raw_fd()) { if unsafe { fchown(tmp_file.as_raw_fd(), md.uid(), md.gid()) } == -1 { FLOG!( history_file,