cedric pushed a commit to branch master.

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

commit a1243410a78c605560309911ccf46f9068c78541
Author: Vincent Torri <vincent dot torri at gmail dot com>
Date:   Fri Nov 6 19:30:57 2015 +0100

    eina/efreet: open file with binary file on Windows
    
    @fix
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/bin/efreet/efreet_desktop_cache_create.c | 6 +++++-
 src/lib/eina/eina_file_common.c              | 8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/bin/efreet/efreet_desktop_cache_create.c 
b/src/bin/efreet/efreet_desktop_cache_create.c
index db14d46..399cc81 100644
--- a/src/bin/efreet/efreet_desktop_cache_create.c
+++ b/src/bin/efreet/efreet_desktop_cache_create.c
@@ -15,6 +15,10 @@
 #include <Ecore.h>
 #include <Ecore_File.h>
 
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
 #define EFREET_MODULE_LOG_DOM _efreet_desktop_cache_log_dom
 static int _efreet_desktop_cache_log_dom = -1;
 
@@ -207,7 +211,7 @@ cache_lock_file(void)
     int lockfd;
 
     snprintf(file, sizeof(file), "%s/efreet/desktop_data.lock", 
efreet_cache_home_get());
-    lockfd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+    lockfd = open(file, O_CREAT | O_BINARY | O_RDWR, S_IRUSR | S_IWUSR);
     if (lockfd < 0) return -1;
     efreet_fsetowner(lockfd);
 
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 367ba8b..4ffd2ed 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -48,6 +48,10 @@
 # include <Escape.h>
 #endif
 
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
 #ifdef MAP_FAILED
 # undef MAP_FAILED
 #endif
@@ -874,13 +878,13 @@ eina_file_copy(const char *src, const char *dst, 
Eina_File_Copy_Flags flags, Ein
    EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
 
-   s = open(src, O_RDONLY);
+   s = open(src, O_RDONLY | O_BINARY);
    EINA_SAFETY_ON_TRUE_RETURN_VAL (s < 0, EINA_FALSE);
 
    success = (fstat(s, &st) == 0);
    EINA_SAFETY_ON_FALSE_GOTO(success, end);
 
-   d = open(dst, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+   d = open(dst, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
    EINA_SAFETY_ON_TRUE_GOTO(d < 0, end);
 
    success = _eina_file_copy_internal(s, d, st.st_size, cb, cb_data);

-- 


Reply via email to