summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-09-01 20:07:40 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-09-01 20:07:40 +0200
commite22805ef116d8c14eced3a2b5089532357bd343c (patch)
tree0d840fb561e316d59347d9ea443c2df48183ac24 /updater/blockimg.cpp
parentSwitch recovery to libbase logging (diff)
parentMerge "Check an edge case when read(2) returns 0" am: 3202b8faf4 am: 852ae8d0fb (diff)
downloadandroid_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.tar
android_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.tar.gz
android_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.tar.bz2
android_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.tar.lz
android_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.tar.xz
android_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.tar.zst
android_bootable_recovery-e22805ef116d8c14eced3a2b5089532357bd343c.zip
Diffstat (limited to 'updater/blockimg.cpp')
-rw-r--r--updater/blockimg.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index f00bc4bff..0caa1acbd 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -151,6 +151,10 @@ static int read_all(int fd, uint8_t* data, size_t size) {
failure_type = kFreadFailure;
fprintf(stderr, "read failed: %s\n", strerror(errno));
return -1;
+ } else if (r == 0) {
+ failure_type = kFreadFailure;
+ fprintf(stderr, "read reached unexpected EOF.\n");
+ return -1;
}
so_far += r;
}