summaryrefslogtreecommitdiffstats
path: root/tests/ecp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ecp.c')
-rw-r--r--tests/ecp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/ecp.c b/tests/ecp.c
index 38a6859e..0882c54e 100644
--- a/tests/ecp.c
+++ b/tests/ecp.c
@@ -34,7 +34,7 @@ main (int argc, char *argv[])
elf_version (EV_CURRENT);
- int infd = open (argv[1], O_RDONLY);
+ int infd = open (argv[1], O_RDONLY | O_BINARY);
if (infd == -1)
error (EXIT_FAILURE, errno, "cannot open input file '%s'", argv[1]);
@@ -46,6 +46,9 @@ main (int argc, char *argv[])
int outfd = creat (argv[2], 0666);
if (outfd == -1)
error (EXIT_FAILURE, errno, "cannot open output file '%s'", argv[2]);
+#if (defined _WIN32 || defined __WIN32__)
+ _setmode (outfd, O_BINARY);
+#endif
Elf *outelf = elf_begin (outfd, ELF_C_WRITE, NULL);
if (outelf == NULL)