summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2015-12-03 11:42:08 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-12-05 21:06:04 +0100
commit0497b9685c782c24fba84a1d5391edaa8d5ce10a (patch)
tree7a9547ea7ab407cfa555598646302bbc0b21b8c4
parent4f242fb48a5cf18b6e5ea6598681486abf791771 (diff)
efl: add binary mode to open() calls
This allows better compatibility with Windows Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/eeze/eeze_scanner.c6
-rw-r--r--src/bin/efreet/efreet_icon_cache_create.c6
-rw-r--r--src/examples/ecore/ecore_con_url_download_example.c6
-rw-r--r--src/lib/ecore/ecore.c8
-rw-r--r--src/lib/ecore_evas/ecore_evas.c8
-rw-r--r--src/modules/ecore_buffer/shm/ecore_buffer_shm.c6
-rw-r--r--src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c6
-rw-r--r--src/modules/evas/image_loaders/generic/evas_image_load_generic.c6
-rw-r--r--src/tests/ecore/ecore_test_ecore_file.c14
-rw-r--r--src/tests/eet/eet_suite.c6
-rw-r--r--src/tests/eina/eina_test_file.c14
-rw-r--r--src/tests/eio/eio_test_file.c8
12 files changed, 71 insertions, 23 deletions
diff --git a/src/bin/eeze/eeze_scanner.c b/src/bin/eeze/eeze_scanner.c
index 416f9ea51e..8fefe30ff4 100644
--- a/src/bin/eeze/eeze_scanner.c
+++ b/src/bin/eeze/eeze_scanner.c
@@ -20,6 +20,10 @@
20#define ERR(...) EINA_LOG_DOM_ERR(es_log_dom, __VA_ARGS__) 20#define ERR(...) EINA_LOG_DOM_ERR(es_log_dom, __VA_ARGS__)
21#define CRI(...) EINA_LOG_DOM_CRIT(es_log_dom, __VA_ARGS__) 21#define CRI(...) EINA_LOG_DOM_CRIT(es_log_dom, __VA_ARGS__)
22 22
23#ifndef O_BINARY
24# define O_BINARY 0
25#endif
26
23static int es_log_dom = -1; 27static int es_log_dom = -1;
24static Ecore_Con_Server *svr = NULL; 28static Ecore_Con_Server *svr = NULL;
25static Eet_Data_Descriptor *es_edd = NULL; 29static Eet_Data_Descriptor *es_edd = NULL;
@@ -186,7 +190,7 @@ cdrom_timer(Eeze_Scanner_Device *dev)
186 /* cdrom already mounted, no need to poll */ 190 /* cdrom already mounted, no need to poll */
187 if (dev->mounted) return EINA_TRUE; 191 if (dev->mounted) return EINA_TRUE;
188 devpath = eeze_udev_syspath_get_devpath(dev->device); 192 devpath = eeze_udev_syspath_get_devpath(dev->device);
189 fd = open(devpath, O_RDONLY); 193 fd = open(devpath, O_RDONLY | O_BINARY);
190 if (fd < 0) 194 if (fd < 0)
191 { 195 {
192 Eina_List *l; 196 Eina_List *l;
diff --git a/src/bin/efreet/efreet_icon_cache_create.c b/src/bin/efreet/efreet_icon_cache_create.c
index 8ed0fe60ee..920e28e673 100644
--- a/src/bin/efreet/efreet_icon_cache_create.c
+++ b/src/bin/efreet/efreet_icon_cache_create.c
@@ -22,6 +22,10 @@ static int _efreet_icon_cache_log_dom = -1;
22#include "efreet_private.h" 22#include "efreet_private.h"
23#include "efreet_cache_private.h" 23#include "efreet_cache_private.h"
24 24
25#ifndef O_BINARY
26# define O_BINARY 0
27#endif
28
25static Eina_Array *exts = NULL; 29static Eina_Array *exts = NULL;
26static Eina_Array *extra_dirs = NULL; 30static Eina_Array *extra_dirs = NULL;
27static Eina_Array *strs = NULL; 31static Eina_Array *strs = NULL;
@@ -676,7 +680,7 @@ cache_lock_file(void)
676 int lockfd; 680 int lockfd;
677 681
678 snprintf(file, sizeof(file), "%s/efreet/icon_data.lock", efreet_cache_home_get()); 682 snprintf(file, sizeof(file), "%s/efreet/icon_data.lock", efreet_cache_home_get());
679 lockfd = open(file, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); 683 lockfd = open(file, O_CREAT | O_BINARY | O_RDWR, S_IRUSR | S_IWUSR);
680 if (lockfd < 0) return -1; 684 if (lockfd < 0) return -1;
681 efreet_fsetowner(lockfd); 685 efreet_fsetowner(lockfd);
682 686
diff --git a/src/examples/ecore/ecore_con_url_download_example.c b/src/examples/ecore/ecore_con_url_download_example.c
index 98c7b577c4..dcf634ec98 100644
--- a/src/examples/ecore/ecore_con_url_download_example.c
+++ b/src/examples/ecore/ecore_con_url_download_example.c
@@ -10,6 +10,10 @@
10#include <Ecore.h> 10#include <Ecore.h>
11#include <Ecore_Con.h> 11#include <Ecore_Con.h>
12 12
13#ifndef O_BINARY
14# define O_BINARY 0
15#endif
16
13struct _request 17struct _request
14{ 18{
15 long size; 19 long size;
@@ -68,7 +72,7 @@ main(int argc, const char *argv[])
68 return -1; 72 return -1;
69 } 73 }
70 74
71 fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644); 75 fd = open(filename, O_CREAT | O_BINARY | O_WRONLY | O_TRUNC, 0644);
72 76
73 if (fd == -1) 77 if (fd == -1)
74 { 78 {
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index d9fc9d9845..e5a4c4c88f 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -35,6 +35,10 @@
35#include <malloc.h> 35#include <malloc.h>
36#endif 36#endif
37 37
38#ifndef O_BINARY
39# define O_BINARY 0
40#endif
41
38static Ecore_Version _version = { VMAJ, VMIN, VMIC, VREV }; 42static Ecore_Version _version = { VMAJ, VMIN, VMIC, VREV };
39EAPI Ecore_Version *ecore_version = &_version; 43EAPI Ecore_Version *ecore_version = &_version;
40 44
@@ -777,11 +781,11 @@ _ecore_fps_debug_init(void)
777 tmp = eina_environment_tmp_get(); 781 tmp = eina_environment_tmp_get();
778 pid = (int)getpid(); 782 pid = (int)getpid();
779 snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid); 783 snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid);
780 _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); 784 _ecore_fps_debug_fd = open(buf, O_CREAT | O_BINARY | O_TRUNC | O_RDWR, 0644);
781 if (_ecore_fps_debug_fd < 0) 785 if (_ecore_fps_debug_fd < 0)
782 { 786 {
783 unlink(buf); 787 unlink(buf);
784 _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); 788 _ecore_fps_debug_fd = open(buf, O_CREAT | O_BINARY | O_TRUNC | O_RDWR, 0644);
785 } 789 }
786 if (_ecore_fps_debug_fd >= 0) 790 if (_ecore_fps_debug_fd >= 0)
787 { 791 {
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index befa11b7b0..076b3f5001 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -34,6 +34,10 @@
34#include "ecore_evas_extn.h" 34#include "ecore_evas_extn.h"
35#include "ecore_evas_win32.h" 35#include "ecore_evas_win32.h"
36 36
37#ifndef O_BINARY
38# define O_BINARY 0
39#endif
40
37EAPI Eina_Bool _ecore_evas_app_comp_sync = EINA_FALSE; 41EAPI Eina_Bool _ecore_evas_app_comp_sync = EINA_FALSE;
38EAPI int _ecore_evas_log_dom = -1; 42EAPI int _ecore_evas_log_dom = -1;
39static int _ecore_evas_init_count = 0; 43static int _ecore_evas_init_count = 0;
@@ -2973,11 +2977,11 @@ _ecore_evas_fps_debug_init(void)
2973 2977
2974 snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", 2978 snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i",
2975 eina_environment_tmp_get(), (int)getpid()); 2979 eina_environment_tmp_get(), (int)getpid());
2976 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); 2980 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_BINARY | O_TRUNC | O_RDWR, 0644);
2977 if (_ecore_evas_fps_debug_fd < 0) 2981 if (_ecore_evas_fps_debug_fd < 0)
2978 { 2982 {
2979 unlink(buf); 2983 unlink(buf);
2980 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); 2984 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_BINARY | O_TRUNC | O_RDWR, 0644);
2981 } 2985 }
2982 if (_ecore_evas_fps_debug_fd >= 0) 2986 if (_ecore_evas_fps_debug_fd >= 0)
2983 { 2987 {
diff --git a/src/modules/ecore_buffer/shm/ecore_buffer_shm.c b/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
index 75900ea094..6440071dc5 100644
--- a/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
+++ b/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
@@ -14,6 +14,10 @@
14#include <Ecore.h> 14#include <Ecore.h>
15#include <Ecore_Buffer.h> 15#include <Ecore_Buffer.h>
16 16
17#ifndef O_BINARY
18# define O_BINARY 0
19#endif
20
17typedef struct _Ecore_Buffer_Shm_Data Ecore_Buffer_Shm_Data; 21typedef struct _Ecore_Buffer_Shm_Data Ecore_Buffer_Shm_Data;
18 22
19struct _Ecore_Buffer_Shm_Data { 23struct _Ecore_Buffer_Shm_Data {
@@ -102,7 +106,7 @@ _ecore_buffer_shm_buffer_export(Ecore_Buffer_Module_Data bmdata EINA_UNUSED, Eco
102 Ecore_Buffer_Shm_Data* b = bdata; 106 Ecore_Buffer_Shm_Data* b = bdata;
103 int fd; 107 int fd;
104 108
105 fd = open(b->file, O_RDWR | O_CLOEXEC); 109 fd = open(b->file, O_RDWR | O_BINARY | O_CLOEXEC);
106 if (id) *id = fd; 110 if (id) *id = fd;
107 111
108 return EXPORT_TYPE_FD; 112 return EXPORT_TYPE_FD;
diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
index 245534fba3..28ffcc31f9 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
@@ -1,5 +1,9 @@
1#include "ecore_evas_extn_engine.h" 1#include "ecore_evas_extn_engine.h"
2 2
3#ifndef O_BINARY
4# define O_BINARY 0
5#endif
6
3struct _Extnbuf 7struct _Extnbuf
4{ 8{
5 const char *file, *lock; 9 const char *file, *lock;
@@ -165,7 +169,7 @@ _extnbuf_lock_file_set(Extnbuf *b, const char *file)
165 } 169 }
166 b->lock = eina_stringshare_add(file); 170 b->lock = eina_stringshare_add(file);
167 if (!b->lock) goto err; 171 if (!b->lock) goto err;
168 b->lockfd = open(b->lock, O_RDWR); 172 b->lockfd = open(b->lock, O_RDWR | O_BINARY);
169 if (b->lockfd >= 0) return EINA_TRUE; 173 if (b->lockfd >= 0) return EINA_TRUE;
170err: 174err:
171 if (b->lock) eina_stringshare_del(b->lock); 175 if (b->lock) eina_stringshare_del(b->lock);
diff --git a/src/modules/evas/image_loaders/generic/evas_image_load_generic.c b/src/modules/evas/image_loaders/generic/evas_image_load_generic.c
index 78488d1036..3bca7c5ad3 100644
--- a/src/modules/evas/image_loaders/generic/evas_image_load_generic.c
+++ b/src/modules/evas/image_loaders/generic/evas_image_load_generic.c
@@ -16,6 +16,10 @@
16#include <fcntl.h> 16#include <fcntl.h>
17#include <ctype.h> 17#include <ctype.h>
18 18
19#ifndef O_BINARY
20# define O_BINARY 0
21#endif
22
19typedef struct _Evas_Loader_Internal Evas_Loader_Internal; 23typedef struct _Evas_Loader_Internal Evas_Loader_Internal;
20struct _Evas_Loader_Internal 24struct _Evas_Loader_Internal
21{ 25{
@@ -329,7 +333,7 @@ getdata:
329 333
330 // open 334 // open
331 if (tmpfname) 335 if (tmpfname)
332 fd = open(tmpfname, O_RDONLY, S_IRUSR); 336 fd = open(tmpfname, O_RDONLY | O_BINARY, S_IRUSR);
333#ifdef HAVE_SHM_OPEN 337#ifdef HAVE_SHM_OPEN
334 else if (shmfname) 338 else if (shmfname)
335 fd = shm_open(shmfname, O_RDONLY, S_IRUSR); 339 fd = shm_open(shmfname, O_RDONLY, S_IRUSR);
diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c
index 1e2d801039..28ffb83e5a 100644
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ b/src/tests/ecore/ecore_test_ecore_file.c
@@ -15,6 +15,10 @@
15 15
16#include "ecore_suite.h" 16#include "ecore_suite.h"
17 17
18#ifndef O_BINARY
19# define O_BINARY 0
20#endif
21
18#define MAXSIZE 256 22#define MAXSIZE 256
19 23
20void 24void
@@ -242,7 +246,7 @@ START_TEST(ecore_test_ecore_file_operations)
242 src_file = get_tmp_file(); 246 src_file = get_tmp_file();
243 fail_if(!src_file); 247 fail_if(!src_file);
244 fail_if(ecore_file_remove(src_file) != EINA_TRUE); 248 fail_if(ecore_file_remove(src_file) != EINA_TRUE);
245 fd = open(src_file, O_RDWR|O_CREAT, 0700); 249 fd = open(src_file, O_RDWR | O_BINARY | O_CREAT, 0700);
246 fail_if(fd < 0); 250 fail_if(fd < 0);
247 fail_if(close(fd) != 0); 251 fail_if(close(fd) != 0);
248 fail_if(ecore_file_can_exec(src_file) != EINA_TRUE); 252 fail_if(ecore_file_can_exec(src_file) != EINA_TRUE);
@@ -295,7 +299,7 @@ START_TEST(ecore_test_ecore_file_operations)
295 src_file = get_tmp_file(); 299 src_file = get_tmp_file();
296 fail_if(!src_file); 300 fail_if(!src_file);
297 fail_if(ecore_file_remove(src_file) != EINA_TRUE); 301 fail_if(ecore_file_remove(src_file) != EINA_TRUE);
298 fd = open(src_file, O_RDWR|O_CREAT, 0400); 302 fd = open(src_file, O_RDWR | O_BINARY | O_CREAT, 0400);
299 fail_if(fd < 0); 303 fail_if(fd < 0);
300 fail_if(close(fd) != 0); 304 fail_if(close(fd) != 0);
301 fail_if(ecore_file_can_read(src_file) != EINA_TRUE); 305 fail_if(ecore_file_can_read(src_file) != EINA_TRUE);
@@ -306,7 +310,7 @@ START_TEST(ecore_test_ecore_file_operations)
306 src_file = get_tmp_file(); 310 src_file = get_tmp_file();
307 fail_if(!src_file); 311 fail_if(!src_file);
308 fail_if(ecore_file_remove(src_file) != EINA_TRUE); 312 fail_if(ecore_file_remove(src_file) != EINA_TRUE);
309 fd = open(src_file, O_RDWR|O_CREAT, 0200); 313 fd = open(src_file, O_RDWR | O_BINARY | O_CREAT, 0200);
310 fail_if(fd < 0); 314 fail_if(fd < 0);
311 fail_if(close(fd) != 0); 315 fail_if(close(fd) != 0);
312 fail_if(ecore_file_can_read(src_file) != EINA_FALSE); 316 fail_if(ecore_file_can_read(src_file) != EINA_FALSE);
@@ -316,7 +320,7 @@ START_TEST(ecore_test_ecore_file_operations)
316 src_file = get_tmp_file(); 320 src_file = get_tmp_file();
317 fail_if(!src_file); 321 fail_if(!src_file);
318 fail_if(ecore_file_remove(src_file) != EINA_TRUE); 322 fail_if(ecore_file_remove(src_file) != EINA_TRUE);
319 fd = open(src_file, O_RDWR|O_CREAT, 0100); 323 fd = open(src_file, O_RDWR | O_BINARY | O_CREAT, 0100);
320 fail_if(fd < 0); 324 fail_if(fd < 0);
321 fail_if(close(fd) != 0); 325 fail_if(close(fd) != 0);
322 fail_if(ecore_file_can_read(src_file) != EINA_FALSE); 326 fail_if(ecore_file_can_read(src_file) != EINA_FALSE);
@@ -355,7 +359,7 @@ START_TEST(ecore_test_ecore_file_path)
355 src_file = get_tmp_file(); 359 src_file = get_tmp_file();
356 fail_if(!src_file); 360 fail_if(!src_file);
357 fail_if(ecore_file_remove(src_file) != EINA_TRUE); 361 fail_if(ecore_file_remove(src_file) != EINA_TRUE);
358 fd = open(src_file, O_RDWR|O_CREAT, 0700); 362 fd = open(src_file, O_RDWR | O_BINARY | O_CREAT, 0700);
359 fail_if(fd < 0); 363 fail_if(fd < 0);
360 fail_if(close(fd) != 0); 364 fail_if(close(fd) != 0);
361 fail_if(ecore_file_can_exec(src_file) != EINA_TRUE); 365 fail_if(ecore_file_can_exec(src_file) != EINA_TRUE);
diff --git a/src/tests/eet/eet_suite.c b/src/tests/eet/eet_suite.c
index 673294bbb9..e7737a7f1c 100644
--- a/src/tests/eet/eet_suite.c
+++ b/src/tests/eet/eet_suite.c
@@ -17,6 +17,10 @@
17 17
18#include "eet_suite.h" 18#include "eet_suite.h"
19 19
20#ifndef O_BINARY
21# define O_BINARY 0
22#endif
23
20static char _key_pem[PATH_MAX] = ""; 24static char _key_pem[PATH_MAX] = "";
21static char _cert_pem[PATH_MAX] = ""; 25static char _cert_pem[PATH_MAX] = "";
22static char _key_enc[PATH_MAX] = ""; 26static char _key_enc[PATH_MAX] = "";
@@ -1775,7 +1779,7 @@ START_TEST(eet_identity_simple)
1775 eet_clearcache(); 1779 eet_clearcache();
1776 1780
1777 /* Corrupting the file. */ 1781 /* Corrupting the file. */
1778 fd = open(file, O_WRONLY); 1782 fd = open(file, O_WRONLY | O_BINARY);
1779 fail_if(fd < 0); 1783 fail_if(fd < 0);
1780 1784
1781 fail_if(lseek(fd, 200, SEEK_SET) != 200); 1785 fail_if(lseek(fd, 200, SEEK_SET) != 200);
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 617ce88287..c307b92809 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -38,6 +38,10 @@
38# define PATH_SEP_C '/' 38# define PATH_SEP_C '/'
39#endif 39#endif
40 40
41#ifndef O_BINARY
42# define O_BINARY 0
43#endif
44
41static int default_dir_rights = 0777; 45static int default_dir_rights = 0777;
42const int file_min_offset = 1; 46const int file_min_offset = 1;
43 47
@@ -353,12 +357,12 @@ START_TEST(eina_file_map_new_test)
353 strcpy(test_file2_path, (char *)test_dirname); 357 strcpy(test_file2_path, (char *)test_dirname);
354 strcat(test_file2_path, test_file2_name_part); 358 strcat(test_file2_path, test_file2_name_part);
355 359
356 fd = open(test_file_path, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 360 fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
357 fail_if(fd == 0); 361 fail_if(fd == 0);
358 fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string)); 362 fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string));
359 close(fd); 363 close(fd);
360 364
361 fd = open(test_file2_path, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 365 fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
362 fail_if(fd == 0); 366 fail_if(fd == 0);
363 fail_if(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset); 367 fail_if(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset);
364 close(fd); 368 close(fd);
@@ -566,7 +570,7 @@ START_TEST(eina_test_file_xattr)
566 eina_init(); 570 eina_init();
567 test_file_path = get_full_path(XATTR_TEST_DIR, filename); 571 test_file_path = get_full_path(XATTR_TEST_DIR, filename);
568 572
569 fd = open(test_file_path, O_RDONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO); 573 fd = open(test_file_path, O_RDONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
570 fail_if(fd == 0); 574 fail_if(fd == 0);
571 close(fd); 575 close(fd);
572 576
@@ -699,12 +703,12 @@ START_TEST(eina_test_file_statat)
699 test_file1_path = get_full_path(test_dirname, "example1.txt"); 703 test_file1_path = get_full_path(test_dirname, "example1.txt");
700 test_file2_path = get_full_path(test_dirname, "example2.txt"); 704 test_file2_path = get_full_path(test_dirname, "example2.txt");
701 705
702 fd = open(test_file1_path, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 706 fd = open(test_file1_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
703 fail_if(fd == 0); 707 fail_if(fd == 0);
704 fail_if(write(fd, template, template_size) != template_size); 708 fail_if(write(fd, template, template_size) != template_size);
705 close(fd); 709 close(fd);
706 710
707 fd = open(test_file2_path, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 711 fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
708 fail_if(fd == 0); 712 fail_if(fd == 0);
709 fail_if(write(fd, template, template_size) != template_size); 713 fail_if(write(fd, template, template_size) != template_size);
710 close(fd); 714 close(fd);
diff --git a/src/tests/eio/eio_test_file.c b/src/tests/eio/eio_test_file.c
index f0e231cd99..c17246ec26 100644
--- a/src/tests/eio/eio_test_file.c
+++ b/src/tests/eio/eio_test_file.c
@@ -14,6 +14,10 @@
14 14
15#include "eio_suite.h" 15#include "eio_suite.h"
16 16
17#ifndef O_BINARY
18# define O_BINARY 0
19#endif
20
17static unsigned int default_rights = 0755; 21static unsigned int default_rights = 0755;
18static int test_count = 0; 22static int test_count = 0;
19static const char *good_dirs[] = 23static const char *good_dirs[] =
@@ -154,7 +158,7 @@ create_test_dirs(Eina_Tmpstr *test_dirname)
154 for (i = 0; i != count; ++i) 158 for (i = 0; i != count; ++i)
155 { 159 {
156 Eina_Tmpstr *filename = get_full_path(test_dirname, files[i]); 160 Eina_Tmpstr *filename = get_full_path(test_dirname, files[i]);
157 fd = open(filename, O_RDWR|O_CREAT, default_rights); 161 fd = open(filename, O_RDWR | O_BINARY | O_CREAT, default_rights);
158 fail_if(fd < 0); 162 fail_if(fd < 0);
159 fail_if(close(fd) != 0); 163 fail_if(close(fd) != 0);
160 eina_tmpstr_del(filename); 164 eina_tmpstr_del(filename);
@@ -163,7 +167,7 @@ create_test_dirs(Eina_Tmpstr *test_dirname)
163 for (i = 0; i != count; ++i) 167 for (i = 0; i != count; ++i)
164 { 168 {
165 Eina_Tmpstr *filename = get_full_path(nested_dirname, files[i]); 169 Eina_Tmpstr *filename = get_full_path(nested_dirname, files[i]);
166 fd = open(filename, O_RDWR|O_CREAT, default_rights); 170 fd = open(filename, O_RDWR | O_BINARY | O_CREAT, default_rights);
167 fail_if(fd < 0); 171 fail_if(fd < 0);
168 fail_if(close(fd) != 0); 172 fail_if(close(fd) != 0);
169 eina_tmpstr_del(filename); 173 eina_tmpstr_del(filename);