diff options
author | Hridya Valsaraju <hridya@google.com> | 2019-04-03 17:57:00 -0700 |
---|---|---|
committer | Hridya Valsaraju <hridya@google.com> | 2019-04-03 18:14:14 -0700 |
commit | 1a6f6feff425edf6076269c0f971675fa41de56c (patch) | |
tree | fad737f7740e662a47e86eec0c4c0326ebae4353 /fastboot/fastboot.cpp | |
parent | aaee497db2b74e55dc1779abb41b294afb954349 (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
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r-- | fastboot/fastboot.cpp | 2 |
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) { |