summaryrefslogtreecommitdiffstats
path: root/libelf
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 /libelf
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 'libelf')
-rw-r--r--libelf/ChangeLog4
-rw-r--r--libelf/nlist.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index fd20ebb7..0f17347b 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,9 @@
2017-05-04 Ulf Hermann <[email protected]>
+ * nlist.c: Open files in O_BINARY.
+
+2017-05-04 Ulf Hermann <[email protected]>
+
* elf_update.c: Don't try to posix_fallocate on systems where it isn't
available. Don't fchmod the output file if there is no fchmod.
diff --git a/libelf/nlist.c b/libelf/nlist.c
index c7b32fdb..f8488c14 100644
--- a/libelf/nlist.c
+++ b/libelf/nlist.c
@@ -71,7 +71,7 @@ nlist (const char *filename, struct nlist *nl)
size_t cnt;
/* Open the file. */
- fd = open (filename, O_RDONLY);
+ fd = open (filename, O_RDONLY | O_BINARY);
if (fd == -1)
{
__libelf_seterrno (ELF_E_NOFILE);