summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-28 20:46:05 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-28 20:46:05 +0200
commit14df07dd1897f6803535a803e4dac728fbd02314 (patch)
tree6d99a10dac6d1c579f9fbfb63618d15734d210c6
parentam 4b3ad009: am 0622ccb3: am 6a4a33e3: Merge "applypatch: Fix the checking in WriteToPartition()." (diff)
parentam 7666f65b: am 62e19231: Merge "updater: Hoist fsync() to outer loop." (diff)
downloadandroid_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.tar
android_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.tar.gz
android_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.tar.bz2
android_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.tar.lz
android_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.tar.xz
android_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.tar.zst
android_bootable_recovery-14df07dd1897f6803535a803e4dac728fbd02314.zip
Diffstat (limited to '')
-rw-r--r--updater/blockimg.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 258d97552..77117db05 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -192,11 +192,6 @@ static int write_all(int fd, const uint8_t* data, size_t size) {
written += w;
}
- if (fsync(fd) == -1) {
- fprintf(stderr, "fsync failed: %s\n", strerror(errno));
- return -1;
- }
-
return 0;
}
@@ -728,7 +723,7 @@ static int WriteStash(const char* base, const char* id, int blocks, uint8_t* buf
fprintf(stderr, " writing %d blocks to %s\n", blocks, cn);
- fd = TEMP_FAILURE_RETRY(open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, STASH_FILE_MODE));
+ fd = TEMP_FAILURE_RETRY(open(fn, O_WRONLY | O_CREAT | O_TRUNC, STASH_FILE_MODE));
if (fd == -1) {
fprintf(stderr, "failed to create \"%s\": %s\n", fn, strerror(errno));
@@ -1762,6 +1757,10 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc,
}
if (params.canwrite) {
+ if (fsync(params.fd) == -1) {
+ fprintf(stderr, "fsync failed: %s\n", strerror(errno));
+ goto pbiudone;
+ }
fprintf(cmd_pipe, "set_progress %.4f\n", (double) params.written / total_blocks);
fflush(cmd_pipe);
}