tRefuse to store a secret that already exists - safe - password protected secret keeper
(HTM) git clone git://git.z3bra.org/safe.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 5bca68cbe7e38dd4c00464515a9755196db4fc8b
(DIR) parent fc05dcf4f8bcdcbb199a7a9d9a98e35852ad135e
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Mon, 3 Jun 2019 12:27:55 +0200
Refuse to store a secret that already exists
Diffstat:
M safe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/safe.c b/safe.c
t@@ -304,7 +304,7 @@ store_secret(struct safe *s, int fd, char *name)
genkey(s);
mkdir_p(dirname(name), 0700);
- sfd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ sfd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (sfd < 0)
err(1, "%s", name);