summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-10-16 04:56:51 +0200
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-10-16 04:56:51 +0200
commit0b26b1bd8950b0e385a2f96c3a123d0dee1b67b4 (patch)
tree87f61330776d0125e019d7a328518c7b2a2a50d3 /src/lib/eina
parentbd5a5e7fce3931476bbc68a156be28e58f5d7ef8 (diff)
eina: And guard the right function with umask
Thanks Cedric.
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_file_common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 9a222c2b47..3a68345c6e 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -878,15 +878,16 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path)
878 tmpdir = (char *)evil_tmpdir_get(); 878 tmpdir = (char *)evil_tmpdir_get();
879#endif /* ! HAVE_EVIL */ 879#endif /* ! HAVE_EVIL */
880 880
881 snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename);
882
881 /* 883 /*
882 * Make sure temp file is created with secure permissions, 884 * Make sure temp file is created with secure permissions,
883 * http://man7.org/linux/man-pages/man3/mkstemp.3.html#NOTES 885 * http://man7.org/linux/man-pages/man3/mkstemp.3.html#NOTES
884 */ 886 */
885 old_umask = umask(0077); 887 old_umask = umask(0077);
886 snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename); 888 fd = mkstemp(buffer);
887 umask(old_umask); 889 umask(old_umask);
888 890
889 fd = mkstemp(buffer);
890 if (path) *path = eina_tmpstr_add(buffer); 891 if (path) *path = eina_tmpstr_add(buffer);
891 if (fd < 0) 892 if (fd < 0)
892 return -1; 893 return -1;