summaryrefslogtreecommitdiffstats
path: root/libcutils
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-04-16 08:40:55 -0700
committerMark Salyzyn <salyzyn@google.com>2015-04-16 08:44:33 -0700
commit4232b378e79f4254abc16a4254e2ba1b91851f11 (patch)
tree290cfd1f5e97d31fc8afb0a56b9a20a406f39e4e /libcutils
parent93e16dca64443aab69d3007e29f69e93850c7427 (diff)
downloadsystem_core-4232b378e79f4254abc16a4254e2ba1b91851f11.zip
system_core-4232b378e79f4254abc16a4254e2ba1b91851f11.tar.gz
system_core-4232b378e79f4254abc16a4254e2ba1b91851f11.tar.bz2
libcutils: fs_config must use O_BINARY
Bug: 19908228 Change-Id: I3273cf99b320941f9530a015c9e582af72469acb
Diffstat (limited to 'libcutils')
-rw-r--r--libcutils/fs_config.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libcutils/fs_config.c b/libcutils/fs_config.c
index 171bf29..9f8023e 100644
--- a/libcutils/fs_config.c
+++ b/libcutils/fs_config.c
@@ -37,6 +37,10 @@
#include <private/android_filesystem_config.h>
#include <utils/Compat.h>
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
/* The following structure is stored little endian */
struct fs_path_config_from_file {
uint16_t len;
@@ -154,12 +158,12 @@ static int fs_config_open(int dir)
char *name = NULL;
asprintf(&name, "%s%s", out, dir ? conf_dir : conf_file);
if (name) {
- fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY));
+ fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_BINARY));
free(name);
}
}
if (fd < 0) {
- fd = TEMP_FAILURE_RETRY(open(dir ? conf_dir : conf_file, O_RDONLY));
+ fd = TEMP_FAILURE_RETRY(open(dir ? conf_dir : conf_file, O_RDONLY | O_BINARY));
}
return fd;
}