mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 20:31:19 -03:00
fs: open file with O_RDWR before fsync
On Cygwin, fsync() on the history and uvar file fails with "permission denied". Work around this by opening the file in read-write mode instead of read-only mode. Closes #11948
This commit is contained in:
committed by
Johannes Altmanninger
parent
1c853a4d24
commit
cab6b97539
@@ -115,7 +115,7 @@ pub fn file_flags(&self) -> OFlag {
|
||||
Self::Exclusive(WriteMethod::Append) => {
|
||||
OFlag::O_WRONLY | OFlag::O_APPEND | OFlag::O_CREAT
|
||||
}
|
||||
Self::Exclusive(WriteMethod::RenameIntoPlace) => OFlag::O_RDONLY | OFlag::O_CREAT,
|
||||
Self::Exclusive(WriteMethod::RenameIntoPlace) => OFlag::O_RDWR | OFlag::O_CREAT,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,6 +192,7 @@ pub fn fsync(file: &File) -> std::io::Result<()> {
|
||||
-1 => {
|
||||
let os_error = std::io::Error::last_os_error();
|
||||
if os_error.kind() != std::io::ErrorKind::Interrupted {
|
||||
FLOGF!(synced_file_access, "fsync failed: %s", os_error);
|
||||
return Err(os_error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user