(path: &Path, contents: &[u8])
| 458 | } |
| 459 | |
| 460 | pub fn write_file(path: &Path, contents: &[u8]) -> io::Result<()> { |
| 461 | if let Some(parent) = path.parent() { |
| 462 | Self::create_dir_all(parent)?; |
| 463 | } |
| 464 | reject_symlink_components(path, "private store file")?; |
| 465 | Self::open_private(path, fs::OpenOptions::new().write(true).truncate(true))? |
| 466 | .write_all(contents)?; |
| 467 | set_private_file_permissions(path) |
| 468 | } |
| 469 | |
| 470 | /// Appends one line via a single `O_APPEND` write so concurrent hook |
| 471 | /// processes never interleave partial lines or lose each other's entries |
nothing calls this directly
no test coverage detected