summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHridya Valsaraju <hridya@google.com>2019-04-03 17:57:00 -0700
committerHridya Valsaraju <hridya@google.com>2019-04-03 18:14:14 -0700
commit1a6f6feff425edf6076269c0f971675fa41de56c (patch)
treefad737f7740e662a47e86eec0c4c0326ebae4353
parentaaee497db2b74e55dc1779abb41b294afb954349 (diff)
Open image files in binary mode
This is required for read() to function correctly in Windows since it behaves differently in text mode and binary mode and may cause unpredictable behavior depending on the contents of the image file. Bug: 129281908 Test: fastboot.exe flashall Change-Id: I64370af44a050bafea60ff1b0b2be18cc531480a
-rw-r--r--fastboot/fastboot.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 4cdd8bcd9..cf8573ba6 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1407,7 +1407,7 @@ bool LocalImageSource::ReadFile(const std::string& name, std::vector<char>* out)
int LocalImageSource::OpenFile(const std::string& name) const {
auto path = find_item_given_name(name);
- return open(path.c_str(), O_RDONLY);
+ return open(path.c_str(), O_RDONLY | O_BINARY);
}
static void do_flashall(const std::string& slot_override, bool skip_secondary, bool wipe) {