summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2014-09-19 11:16:47 +0200
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-09-19 10:06:32 -0400
commit2cd2b0a76412f5dea4ae6ac90e28df562bcff3ff (patch)
treec5edf3f34ade6376b27bd57d4e3ee76e913e3228
parent349a9f5262163cf5d6449873ceadc75a1ec49b24 (diff)
modules/teamwork: Use eina_file_mkstemp() to avoid problems with umask
Keeping the snprintf to arrange for the tmp file name including the i->addr in the filename. CID: 1039805
-rw-r--r--src/modules/teamwork/e_mod_tw.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/modules/teamwork/e_mod_tw.c b/src/modules/teamwork/e_mod_tw.c
index 1a08285c8..15e4071c8 100644
--- a/src/modules/teamwork/e_mod_tw.c
+++ b/src/modules/teamwork/e_mod_tw.c
@@ -1006,7 +1006,7 @@ tw_show(Media *i)
1006 if (i->video) 1006 if (i->video)
1007 { 1007 {
1008 char buf[PATH_MAX]; 1008 char buf[PATH_MAX];
1009 const char *tmp; 1009 Eina_Tmpstr *tmpfile;
1010 1010
1011 if (tw_config->disable_video) return; 1011 if (tw_config->disable_video) return;
1012 while (i->tmpfile) 1012 while (i->tmpfile)
@@ -1033,9 +1033,7 @@ tw_show(Media *i)
1033 tw_show_video(prev, tw_tmpfile); 1033 tw_show_video(prev, tw_tmpfile);
1034 return; 1034 return;
1035 } 1035 }
1036 tmp = getenv("XDG_RUNTIME_DIR"); 1036 snprintf(buf, sizeof(buf), "teamwork-%s-XXXXXX", ecore_file_file_get(i->addr));
1037 if (!tmp) tmp = "/tmp";
1038 snprintf(buf, sizeof(buf), "%s/teamwork-%s-XXXXXX", tmp, ecore_file_file_get(i->addr));
1039 if (tw_tmpfile) 1037 if (tw_tmpfile)
1040 { 1038 {
1041 if (tw_tmpthread) 1039 if (tw_tmpthread)
@@ -1046,14 +1044,15 @@ tw_show(Media *i)
1046 } 1044 }
1047 close(tw_tmpfd); 1045 close(tw_tmpfd);
1048 } 1046 }
1049 tw_tmpfd = mkstemp(buf); 1047 tw_tmpfd = eina_file_mkstemp(buf, &tmpfile);
1050 eina_stringshare_replace(&tw_tmpfile, buf); 1048 eina_stringshare_replace(&tw_tmpfile, tmpfile);
1051 if (tw_tmpfd < 0) 1049 if (tw_tmpfd < 0)
1052 { 1050 {
1053 ERR("ERROR: %s", strerror(errno)); 1051 ERR("ERROR: %s", strerror(errno));
1054 download_media_cleanup(); 1052 download_media_cleanup();
1055 eina_stringshare_replace(&tw_tmpfile, NULL); 1053 eina_stringshare_replace(&tw_tmpfile, NULL);
1056 tw_tmpthread_media = NULL; 1054 tw_tmpthread_media = NULL;
1055 eina_tmpstr_del(tmpfile);
1057 return; 1056 return;
1058 } 1057 }
1059 tw_tmpthread_media = i; 1058 tw_tmpthread_media = i;