summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2015-11-06 19:30:57 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-11-06 10:53:29 -0800
commita1243410a78c605560309911ccf46f9068c78541 (patch)
tree822db0967979df557cf4abfd0d929ba825f78c2a
parentebf6d95ed6de6f90481cc09a5d18f16251c01b76 (diff)
eina/efreet: open file with binary file on Windows
@fix Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/efreet/efreet_desktop_cache_create.c6
-rw-r--r--src/lib/eina/eina_file_common.c8
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 db14d46293..399cc81393 100644
--- a/src/bin/efreet/efreet_desktop_cache_create.c
+++ b/src/bin/efreet/efreet_desktop_cache_create.c
@@ -15,6 +15,10 @@
15#include <Ecore.h> 15#include <Ecore.h>
16#include <Ecore_File.h> 16#include <Ecore_File.h>
17 17
18#ifndef O_BINARY
19# define O_BINARY 0
20#endif
21
18#define EFREET_MODULE_LOG_DOM _efreet_desktop_cache_log_dom 22#define EFREET_MODULE_LOG_DOM _efreet_desktop_cache_log_dom
19static int _efreet_desktop_cache_log_dom = -1; 23static int _efreet_desktop_cache_log_dom = -1;
20 24
@@ -207,7 +211,7 @@ cache_lock_file(void)
207 int lockfd; 211 int lockfd;
208 212
209 snprintf(file, sizeof(file), "%s/efreet/desktop_data.lock", efreet_cache_home_get()); 213 snprintf(file, sizeof(file), "%s/efreet/desktop_data.lock", efreet_cache_home_get());
210 lockfd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); 214 lockfd = open(file, O_CREAT | O_BINARY | O_RDWR, S_IRUSR | S_IWUSR);
211 if (lockfd < 0) return -1; 215 if (lockfd < 0) return -1;
212 efreet_fsetowner(lockfd); 216 efreet_fsetowner(lockfd);
213 217
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 367ba8b5ab..4ffd2edcc3 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -48,6 +48,10 @@
48# include <Escape.h> 48# include <Escape.h>
49#endif 49#endif
50 50
51#ifndef O_BINARY
52# define O_BINARY 0
53#endif
54
51#ifdef MAP_FAILED 55#ifdef MAP_FAILED
52# undef MAP_FAILED 56# undef MAP_FAILED
53#endif 57#endif
@@ -874,13 +878,13 @@ eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Ein
874 EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE); 878 EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE);
875 EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE); 879 EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
876 880
877 s = open(src, O_RDONLY); 881 s = open(src, O_RDONLY | O_BINARY);
878 EINA_SAFETY_ON_TRUE_RETURN_VAL (s < 0, EINA_FALSE); 882 EINA_SAFETY_ON_TRUE_RETURN_VAL (s < 0, EINA_FALSE);
879 883
880 success = (fstat(s, &st) == 0); 884 success = (fstat(s, &st) == 0);
881 EINA_SAFETY_ON_FALSE_GOTO(success, end); 885 EINA_SAFETY_ON_FALSE_GOTO(success, end);
882 886
883 d = open(dst, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); 887 d = open(dst, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
884 EINA_SAFETY_ON_TRUE_GOTO(d < 0, end); 888 EINA_SAFETY_ON_TRUE_GOTO(d < 0, end);
885 889
886 success = _eina_file_copy_internal(s, d, st.st_size, cb, cb_data); 890 success = _eina_file_copy_internal(s, d, st.st_size, cb, cb_data);