summaryrefslogtreecommitdiffstats
path: root/tests/newdata.c
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-05-04 12:07:54 +0200
committerUlf Hermann <[email protected]>2017-05-08 09:36:02 +0000
commit0cfab8d6e47c165ee02d027c11b9a11c726516fa (patch)
tree07868d226de62c4f9fd80ddb7882fe19151445b0 /tests/newdata.c
parent8ac52d75d47da355c4ace3224161de097db3e8d9 (diff)
Open files in O_BINARY
If O_BINARY is not defined, define it to 0, so that the change has no effect then. Some systems have separate binary and text modes for files, and we don't want the text mode to be used. Change-Id: If7efb5bd448c2a1c7d1eb5dab276849b1b15a3ce Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'tests/newdata.c')
-rw-r--r--tests/newdata.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/newdata.c b/tests/newdata.c
index 9af99564..bb9f313e 100644
--- a/tests/newdata.c
+++ b/tests/newdata.c
@@ -243,7 +243,7 @@ check_elf (int class, int use_mmap)
printf ("\ncheck_elf: %s\n", fname);
- int fd = open (fname, O_RDWR|O_CREAT|O_TRUNC, 00666);
+ int fd = open (fname, O_RDWR | O_BINARY|O_CREAT|O_TRUNC, 00666);
if (fd == -1)
{
printf ("cannot create `%s': %s\n", fname, strerror (errno));
@@ -268,7 +268,7 @@ check_elf (int class, int use_mmap)
close (fd);
// Read the ELF from disk now. And add new data directly.
- fd = open (fname, O_RDONLY);
+ fd = open (fname, O_RDONLY | O_BINARY);
if (fd == -1)
{
printf ("cannot open `%s' read-only: %s\n", fname, strerror (errno));
@@ -298,7 +298,7 @@ check_elf (int class, int use_mmap)
close (fd);
// Read the ELF from disk now. And add new data after raw reading.
- fd = open (fname, O_RDONLY);
+ fd = open (fname, O_RDONLY | O_BINARY);
if (fd == -1)
{
printf ("cannot open `%s' read-only: %s\n", fname, strerror (errno));
@@ -350,7 +350,7 @@ check_elf (int class, int use_mmap)
close (fd);
// Read the ELF from disk now. And add new data after data reading.
- fd = open (fname, O_RDONLY);
+ fd = open (fname, O_RDONLY | O_BINARY);
if (fd == -1)
{
printf ("cannot open `%s' read-only: %s\n", fname, strerror (errno));