summaryrefslogtreecommitdiff
path: root/trust
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-10-16 18:20:12 +0200
committerDaiki Ueno <ueno@gnu.org>2018-10-17 10:13:32 +0200
commitda73c2804b3ca962fa51473bb4c303a5ed32d4a1 (patch)
tree2ba252e380f0511b83274f78073841aa77517a2f /trust
parent033cd90806cb1e2eab7e799703757abc2f07052e (diff)
trust: Set umask before calling mkstemp
Diffstat (limited to 'trust')
-rw-r--r--trust/save.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/trust/save.c b/trust/save.c
index 8184e13..bb77348 100644
--- a/trust/save.c
+++ b/trust/save.c
@@ -95,6 +95,7 @@ p11_save_open_file (const char *path,
{
p11_save_file *file;
char *temp;
+ mode_t mode;
int fd;
return_val_if_fail (path != NULL, NULL);
@@ -105,7 +106,9 @@ p11_save_open_file (const char *path,
if (asprintf (&temp, "%s%s.XXXXXX", path, extension) < 0)
return_val_if_reached (NULL);
+ mode = umask (0077);
fd = mkstemp (temp);
+ umask (mode);
if (fd < 0) {
p11_message_err (errno, "couldn't create file: %s%s", path, extension);
free (temp);