summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-07-19 18:36:12 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-07-20 14:45:13 +0000
commit4ef620c1b74d7442c43ddb03da563639d923f0d2 (patch)
tree9d427ff9d1d833c11b4409fdac88bab206119d06
parent6166020e5f1acc87c3f00f0d2f15f073971be545 (diff)
Add O_BINARY to new open() calls
Windows needs that if you're not reading text. Change-Id: I923782f2c47ef16765f52d6a435f69cb33f50dfd Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--libdw/dwarf_getalt.c4
-rw-r--r--libdw/libdw_find_split_unit.c2
-rw-r--r--src/readelf.c2
-rw-r--r--tests/all-dwarf-ranges.c2
-rw-r--r--tests/attr-integrate-skel.c2
-rw-r--r--tests/dwarf-die-addr-die.c2
-rw-r--r--tests/dwarfcfi.c2
-rw-r--r--tests/get-units-invalid.c2
-rw-r--r--tests/get-units-split.c2
-rw-r--r--tests/next-files.c2
-rw-r--r--tests/next-lines.c2
-rw-r--r--tests/next_cfi.c2
-rw-r--r--tests/unit-info.c4
13 files changed, 15 insertions, 15 deletions
diff --git a/libdw/dwarf_getalt.c b/libdw/dwarf_getalt.c
index 0a12dfae..05624d5d 100644
--- a/libdw/dwarf_getalt.c
+++ b/libdw/dwarf_getalt.c
@@ -133,7 +133,7 @@ find_debug_altlink (Dwarf *dbg)
strcpy (&id_path[sizeof DEBUGINFO_PATH - 1 + sizeof "/.build-id/" - 1
+ 3 + (id_len - 1) * 2], ".debug");
- fd = TEMP_FAILURE_RETRY (open (id_path, O_RDONLY));
+ fd = TEMP_FAILURE_RETRY (open (id_path, O_RDONLY | O_BINARY));
}
/* Fall back on (possible relative) alt file path. */
@@ -142,7 +142,7 @@ find_debug_altlink (Dwarf *dbg)
char *altpath = __libdw_filepath (dbg->debugdir, NULL, altname);
if (altpath != NULL)
{
- fd = TEMP_FAILURE_RETRY (open (altpath, O_RDONLY));
+ fd = TEMP_FAILURE_RETRY (open (altpath, O_RDONLY | O_BINARY));
free (altpath);
}
}
diff --git a/libdw/libdw_find_split_unit.c b/libdw/libdw_find_split_unit.c
index da039e50..2643f797 100644
--- a/libdw/libdw_find_split_unit.c
+++ b/libdw/libdw_find_split_unit.c
@@ -45,7 +45,7 @@
void
try_split_file (Dwarf_CU *cu, const char *dwo_path)
{
- int split_fd = open (dwo_path, O_RDONLY);
+ int split_fd = open (dwo_path, O_RDONLY | O_BINARY);
if (split_fd != -1)
{
Dwarf *split_dwarf = dwarf_begin (split_fd, DWARF_C_READ);
diff --git a/src/readelf.c b/src/readelf.c
index 1045485e..cc084120 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -10919,7 +10919,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
if (skel_name != NULL)
{
- int skel_fd = open (skel_name, O_RDONLY);
+ int skel_fd = open (skel_name, O_RDONLY | O_BINARY);
if (skel_fd == -1)
fprintf (stderr, "Warning: Couldn't open DWARF skeleton file"
" '%s'\n", skel_name);
diff --git a/tests/all-dwarf-ranges.c b/tests/all-dwarf-ranges.c
index 4331a05b..90004b32 100644
--- a/tests/all-dwarf-ranges.c
+++ b/tests/all-dwarf-ranges.c
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
assert (argc >= 2);
const char *name = argv[1];
- int fd = open (name, O_RDONLY);
+ int fd = open (name, O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
Dwarf_CU *cu = NULL;
diff --git a/tests/attr-integrate-skel.c b/tests/attr-integrate-skel.c
index 644cd272..be2e894e 100644
--- a/tests/attr-integrate-skel.c
+++ b/tests/attr-integrate-skel.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
for (int i = 1; i < argc; i++)
{
printf ("file: %s\n", argv[i]);
- int fd = open (argv[i], O_RDONLY);
+ int fd = open (argv[i], O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
{
diff --git a/tests/dwarf-die-addr-die.c b/tests/dwarf-die-addr-die.c
index 7899988f..3482aefc 100644
--- a/tests/dwarf-die-addr-die.c
+++ b/tests/dwarf-die-addr-die.c
@@ -161,7 +161,7 @@ main (int argc, char *argv[])
}
const char *name = argv[1];
- int fd = open (name, O_RDONLY);
+ int fd = open (name, O_RDONLY | O_BINARY);
if (fd < 0)
{
printf ("Cannnot open '%s': %s\n", name, strerror (errno));
diff --git a/tests/dwarfcfi.c b/tests/dwarfcfi.c
index db4a36ff..283a9184 100644
--- a/tests/dwarfcfi.c
+++ b/tests/dwarfcfi.c
@@ -134,7 +134,7 @@ main (int argc, char *argv[])
if (argc <= 2)
error (EXIT_FAILURE, 0, "need file name argument and addresses");
- int fd = open (argv[1], O_RDONLY);
+ int fd = open (argv[1], O_RDONLY | O_BINARY);
if (fd == -1)
error (EXIT_FAILURE, errno, "cannot open input file `%s'", argv[1]);
diff --git a/tests/get-units-invalid.c b/tests/get-units-invalid.c
index 155e12db..ffb6a0f0 100644
--- a/tests/get-units-invalid.c
+++ b/tests/get-units-invalid.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
for (int i = 1; i < argc; i++)
{
printf ("file: %s\n", argv[i]);
- int fd = open (argv[i], O_RDONLY);
+ int fd = open (argv[i], O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
{
diff --git a/tests/get-units-split.c b/tests/get-units-split.c
index 410483a0..483b52d7 100644
--- a/tests/get-units-split.c
+++ b/tests/get-units-split.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
for (int i = 1; i < argc; i++)
{
printf ("file: %s\n", argv[i]);
- int fd = open (argv[i], O_RDONLY);
+ int fd = open (argv[i], O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
{
diff --git a/tests/next-files.c b/tests/next-files.c
index 9de5c8b0..b8e33d97 100644
--- a/tests/next-files.c
+++ b/tests/next-files.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
for (cnt = 1; cnt < argc; ++cnt)
{
- int fd = open (argv[cnt], O_RDONLY);
+ int fd = open (argv[cnt], O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
diff --git a/tests/next-lines.c b/tests/next-lines.c
index cfb74cde..85102010 100644
--- a/tests/next-lines.c
+++ b/tests/next-lines.c
@@ -36,7 +36,7 @@ main (int argc, char *argv[])
for (cnt = 1; cnt < argc; ++cnt)
{
- int fd = open (argv[cnt], O_RDONLY);
+ int fd = open (argv[cnt], O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
diff --git a/tests/next_cfi.c b/tests/next_cfi.c
index b923744f..2b633577 100644
--- a/tests/next_cfi.c
+++ b/tests/next_cfi.c
@@ -83,7 +83,7 @@ main (int argc, char *argv[])
const char *file = argv[1];
printf ("%s\n", file);
- int fd = open (file, O_RDONLY);
+ int fd = open (file, O_RDONLY | O_BINARY);
if (fd == -1)
error (EXIT_FAILURE, errno, "cannot open input file `%s'", file);
diff --git a/tests/unit-info.c b/tests/unit-info.c
index 4fb9a984..ae4c09b8 100644
--- a/tests/unit-info.c
+++ b/tests/unit-info.c
@@ -48,7 +48,7 @@ main (int argc, char *argv[])
for (int i = 1; i < argc; i++)
{
printf ("file: %s\n", argv[i]);
- int fd = open (argv[i], O_RDONLY);
+ int fd = open (argv[i], O_RDONLY | O_BINARY);
Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
{
@@ -176,7 +176,7 @@ main (int argc, char *argv[])
/* And again... */
printf ("rechecking: %s\n", argv[i]);
- fd = open (argv[i], O_RDONLY);
+ fd = open (argv[i], O_RDONLY | O_BINARY);
dbg = dwarf_begin (fd, DWARF_C_READ);
if (dbg == NULL)
{