summaryrefslogtreecommitdiff
path: root/src/bin/efreet
diff options
context:
space:
mode:
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-10-14 13:19:59 +0200
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-10-14 13:19:59 +0200
commit67a8feeb08e9dd6e58a1fb148a826e781ca5260d (patch)
treecef18416f6b0fe7ba6e4b14a9021272c93b75ca8 /src/bin/efreet
parentcc89eb2af953aaadf2c5f2f252169497916e272a (diff)
efreet: Set umask before creating temp file
CID 1039616
Diffstat (limited to 'src/bin/efreet')
-rw-r--r--src/bin/efreet/efreet_desktop_cache_create.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/efreet/efreet_desktop_cache_create.c b/src/bin/efreet/efreet_desktop_cache_create.c
index 577091ffc9..2fc6e917d7 100644
--- a/src/bin/efreet/efreet_desktop_cache_create.c
+++ b/src/bin/efreet/efreet_desktop_cache_create.c
@@ -225,6 +225,7 @@ main(int argc, char **argv)
225 int i; 225 int i;
226 char file[PATH_MAX] = { '\0' }; 226 char file[PATH_MAX] = { '\0' };
227 char util_file[PATH_MAX] = { '\0' }; 227 char util_file[PATH_MAX] = { '\0' };
228 mode_t um;
228 229
229 if (!eina_init()) goto eina_error; 230 if (!eina_init()) goto eina_error;
230 _efreet_desktop_cache_log_dom = 231 _efreet_desktop_cache_log_dom =
@@ -296,14 +297,20 @@ main(int argc, char **argv)
296 297
297 /* create cache */ 298 /* create cache */
298 snprintf(file, sizeof(file), "%s.XXXXXX", efreet_desktop_cache_file()); 299 snprintf(file, sizeof(file), "%s.XXXXXX", efreet_desktop_cache_file());
300 /* set secure umask for temporary files */
301 um = umask(0077);
299 tmpfd = mkstemp(file); 302 tmpfd = mkstemp(file);
303 umask(um);
300 if (tmpfd < 0) goto error; 304 if (tmpfd < 0) goto error;
301 close(tmpfd); 305 close(tmpfd);
302 ef = eet_open(file, EET_FILE_MODE_READ_WRITE); 306 ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
303 if (!ef) goto error; 307 if (!ef) goto error;
304 308
305 snprintf(util_file, sizeof(util_file), "%s.XXXXXX", efreet_desktop_util_cache_file()); 309 snprintf(util_file, sizeof(util_file), "%s.XXXXXX", efreet_desktop_util_cache_file());
310 /* set secure umask for temporary files */
311 um = umask(0077);
306 tmpfd = mkstemp(util_file); 312 tmpfd = mkstemp(util_file);
313 umask(um);
307 if (tmpfd < 0) goto error; 314 if (tmpfd < 0) goto error;
308 close(tmpfd); 315 close(tmpfd);
309 util_ef = eet_open(util_file, EET_FILE_MODE_READ_WRITE); 316 util_ef = eet_open(util_file, EET_FILE_MODE_READ_WRITE);