scope-lock完了

This commit is contained in:
2026-04-18 19:26:23 +09:00
parent a7b9b6fa4b
commit e7a4b76c54
4 changed files with 6 additions and 202 deletions
+6 -7
View File
@@ -13,9 +13,9 @@
//! recovery rides on the next Pod that opens the file — no background
//! reaper.
use std::fs::{File, OpenOptions};
use std::fs::{DirBuilder, File, OpenOptions};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::os::unix::fs::{OpenOptionsExt, PermissionsExt};
use std::os::unix::fs::{DirBuilderExt, OpenOptionsExt};
use std::path::{Path, PathBuf};
use fs4::fs_std::FileExt;
@@ -109,11 +109,10 @@ impl LockFileGuard {
/// allocation table. Existing files/directories are left alone.
pub fn open(path: &Path) -> io::Result<Self> {
if let Some(parent) = path.parent() {
let existed = parent.exists();
std::fs::create_dir_all(parent)?;
if !existed {
std::fs::set_permissions(parent, std::fs::Permissions::from_mode(0o700))?;
}
DirBuilder::new()
.recursive(true)
.mode(0o700)
.create(parent)?;
}
let file = OpenOptions::new()
.read(true)