Skip to content

Commit

Permalink
Set truncate when creating a new key file
Browse files Browse the repository at this point in the history
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
  • Loading branch information
LeeSmet committed Mar 22, 2024
1 parent ac5c48a commit 82caffe
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ async fn save_key_file(key: &crypto::SecretKey, path: &Path) -> io::Result<()> {

let mut file = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.mode(0o600) // rw by the owner, not readable by group or others
.open(path)
Expand Down

0 comments on commit 82caffe

Please sign in to comment.