diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-09 12:50:44 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-09 12:50:44 -0500 |
commit | 49c1c8e4245e5cf93903d5a84b70dc11232b69af (patch) | |
tree | 9876afedeb9692a4accc6e165f1aa4b4736a5b47 /src/persist.rs | |
parent | update readme (diff) | |
download | crab-49c1c8e4245e5cf93903d5a84b70dc11232b69af.tar.gz crab-49c1c8e4245e5cf93903d5a84b70dc11232b69af.tar.bz2 crab-49c1c8e4245e5cf93903d5a84b70dc11232b69af.zip |
force valid arguments
Diffstat (limited to 'src/persist.rs')
-rw-r--r-- | src/persist.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/persist.rs b/src/persist.rs index 7d47232..febd035 100644 --- a/src/persist.rs +++ b/src/persist.rs @@ -83,12 +83,13 @@ fn get_terminal_config() -> Option<Value> { } fn write_terminal_config(id: &i32, data: &str) -> Result<(), Box<dyn std::error::Error>> { - std::fs::write(path(&id), data)?; + std::fs::write(path(&id), "")?; unistd::chown(std::path::Path::new(&path(&id)), Some(unistd::Uid::from(0)), Some(unistd::Gid::from(0)))?; let metadata = std::fs::metadata(path(&id))?; let mut perms = metadata.permissions(); perms.set_mode(0o660); fs::set_permissions(path(&id), perms)?; + std::fs::write(path(&id), data)?; Ok(()) } @@ -98,4 +99,4 @@ fn now() -> u64 { fn path(id: &i32) -> String { return format!("/tmp/crab-{}", id); -}
\ No newline at end of file +} |