Skip to content

Commit

Permalink
Check log file path permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
tjardoo committed Sep 11, 2024
1 parent 0d53aad commit b4344fe
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/drivers/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ impl SingleLogger {
.open(path)
.unwrap();

// @todo
// let md = std::fs::metadata("logs").unwrap();
// let permissions = md.permissions();

// if permissions.readonly() {
// return Err(P2000Error::ConfigurationError(format!(
// "directory /logs is readonly"
// )));
// }
let md = std::fs::metadata(path).unwrap();

if md.permissions().readonly() {
panic!("The logs directory `{path}` is readonly");
}

SingleLogger {
file: Mutex::new(LineWriter::new(file)),
Expand Down

0 comments on commit b4344fe

Please sign in to comment.