summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.cpp
diff options
context:
space:
mode:
authorJed Estep <jestep@google.com>2015-12-16 01:04:53 +0100
committerJed Estep <jestep@google.com>2016-01-06 21:23:42 +0100
commitf1fc48c6e62cfee42d25ad12f443e22d50c15d0b (patch)
tree72fb1777e334ccce8f9f622a364b7c0ed66b828b /updater/blockimg.cpp
parentMerge "imgdiff: skip spurious gzip headers in image files" am: 8e150a5b24 (diff)
downloadandroid_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.tar
android_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.tar.gz
android_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.tar.bz2
android_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.tar.lz
android_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.tar.xz
android_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.tar.zst
android_bootable_recovery-f1fc48c6e62cfee42d25ad12f443e22d50c15d0b.zip
Diffstat (limited to '')
-rw-r--r--updater/blockimg.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 3b26f057a..86be47603 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -44,6 +44,7 @@
#include "edify/expr.h"
#include "mincrypt/sha.h"
#include "minzip/Hash.h"
+#include "otafault/ota_io.h"
#include "print_sha1.h"
#include "unique_fd.h"
#include "updater.h"
@@ -138,7 +139,7 @@ static bool range_overlaps(const RangeSet& r1, const RangeSet& r2) {
static int read_all(int fd, uint8_t* data, size_t size) {
size_t so_far = 0;
while (so_far < size) {
- ssize_t r = TEMP_FAILURE_RETRY(read(fd, data+so_far, size-so_far));
+ ssize_t r = TEMP_FAILURE_RETRY(ota_read(fd, data+so_far, size-so_far));
if (r == -1) {
fprintf(stderr, "read failed: %s\n", strerror(errno));
return -1;
@@ -155,7 +156,7 @@ static int read_all(int fd, std::vector<uint8_t>& buffer, size_t size) {
static int write_all(int fd, const uint8_t* data, size_t size) {
size_t written = 0;
while (written < size) {
- ssize_t w = TEMP_FAILURE_RETRY(write(fd, data+written, size-written));
+ ssize_t w = TEMP_FAILURE_RETRY(ota_write(fd, data+written, size-written));
if (w == -1) {
fprintf(stderr, "write failed: %s\n", strerror(errno));
return -1;
@@ -621,7 +622,7 @@ static int WriteStash(const std::string& base, const std::string& id, int blocks
return -1;
}
- if (fsync(fd) == -1) {
+ if (ota_fsync(fd) == -1) {
fprintf(stderr, "fsync \"%s\" failed: %s\n", fn.c_str(), strerror(errno));
return -1;
}
@@ -641,7 +642,7 @@ static int WriteStash(const std::string& base, const std::string& id, int blocks
return -1;
}
- if (fsync(dfd) == -1) {
+ if (ota_fsync(dfd) == -1) {
fprintf(stderr, "fsync \"%s\" failed: %s\n", dname.c_str(), strerror(errno));
return -1;
}
@@ -1466,7 +1467,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int /* arg
}
if (params.canwrite) {
- if (fsync(params.fd) == -1) {
+ if (ota_fsync(params.fd) == -1) {
fprintf(stderr, "fsync failed: %s\n", strerror(errno));
goto pbiudone;
}
@@ -1491,7 +1492,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int /* arg
rc = 0;
pbiudone:
- if (fsync(params.fd) == -1) {
+ if (ota_fsync(params.fd) == -1) {
fprintf(stderr, "fsync failed: %s\n", strerror(errno));
}
// params.fd will be automatically closed because of the fd_holder above.