From 82caffeaca3b52da2e45eb211b038951a63d5709 Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Fri, 22 Mar 2024 15:13:11 +0100 Subject: [PATCH] Set truncate when creating a new key file Signed-off-by: Lee Smet --- src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.rs b/src/main.rs index dd358c1..1135c14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)