projects
/
petitboot
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
999fd1a
)
discover: Set umask before mkstemp()
author
Samuel Mendoza-Jonas
<sam.mj@au1.ibm.com>
Wed, 11 Nov 2015 23:04:23 +0000
(10:04 +1100)
committer
Samuel Mendoza-Jonas
<sam.mj@au1.ibm.com>
Fri, 18 Dec 2015 00:15:58 +0000
(11:15 +1100)
Fixes Coverity defect #30479
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
discover/paths.c
patch
|
blob
|
history
diff --git
a/discover/paths.c
b/discover/paths.c
index c25671b17a6a22404600da2a64cc9febca93f84f..1269dded35b73960c6b3d51c00efcd1b6e6aaafa 100644
(file)
--- a/
discover/paths.c
+++ b/
discover/paths.c
@@
-6,6
+6,8
@@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <talloc/talloc.h>
#include <system/system.h>
@@
-49,9
+51,12
@@
char *join_paths(void *alloc_ctx, const char *a, const char *b)
static char *local_name(void *ctx)
{
char *ret, tmp[] = "/tmp/pb-XXXXXX";
+ mode_t oldmask;
int fd;
+ oldmask = umask(0644);
fd = mkstemp(tmp);
+ umask(oldmask);
if (fd < 0)
return NULL;