Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rust/forevervm/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ impl ConfigManager {
serde_json::to_string_pretty(config).context("Failed to serialize config")?;
config_str.push('\n');
std::fs::write(&self.config_path, config_str).context("Failed to write config file")?;
Comment thread
paulgb marked this conversation as resolved.

#[cfg(unix)]
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error context to fs::metadata and set_permissions calls for improved debugging.

use std::os::unix::fs::PermissionsExt;
let metadata = std::fs::metadata(&self.config_path)?;
let mut permissions = metadata.permissions();
permissions.set_mode(0o600); // Read/write for owner only
std::fs::set_permissions(&self.config_path, permissions)?;
}

Ok(())
}

Expand Down