cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=291c546143a24d3bf96b0fdb649fdaf0f4cfa833

commit 291c546143a24d3bf96b0fdb649fdaf0f4cfa833
Author: Vincent Torri <[email protected]>
Date:   Tue Sep 23 15:44:05 2014 +0200

    eina: do no use umask on Windows in eina_file_mkstemp()
    
    umask() sets the permissions of the file to read-only on Windows
    (see umask documentation on MSDN).
    This breaks the creation of .edj file (epp needs to modify the
    created file).
    Anyway, on Windows, permissions should be given to anybody.
    
    @fix
    
    Signed-off-by: Cedric BAIL <[email protected]>
---
 src/lib/eina/eina_file_common.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 9c9e9af..2a2e3e4 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -900,7 +900,9 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr 
**path)
    const char *tmpdir = NULL;
    const char *XXXXXX = NULL;
    int fd, len;
+#ifndef _WIN32
    mode_t old_umask;
+#endif
 
 #ifndef HAVE_EVIL
 #if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
@@ -915,11 +917,18 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr 
**path)
 
    len = snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, templatename);
 
-   /* 
+   /*
+    * Unix:
     * Make sure temp file is created with secure permissions,
     * http://man7.org/linux/man-pages/man3/mkstemp.3.html#NOTES
+    *
+    * Windows:
+    * no secure permissions anyway and the umask use below makes
+    * the file read-only.
     */
+#ifndef _WIN32
    old_umask = umask(S_IRWXG|S_IRWXO);
+#endif
    if ((XXXXXX = strstr(buffer, "XXXXXX.")) != NULL)
      {
         int suffixlen = buffer + len - XXXXXX - 6;
@@ -927,7 +936,9 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr 
**path)
      }
    else
      fd = mkstemp(buffer);
+#ifndef _WIN32
    umask(old_umask);
+#endif
 
    if (path) *path = eina_tmpstr_add(buffer);
    if (fd < 0)

-- 


Reply via email to