summaryrefslogtreecommitdiffstats
path: root/mtdutils/flash_image.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-30 06:19:33 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-30 06:19:33 +0200
commit34d3a3d074e977cace29797c428795e1de5b3223 (patch)
treee2c357667b0e76e6fa5a43c7a7951c872c373e9c /mtdutils/flash_image.c
parentam 8c389e9c: Merge "Stop using adb_strtok, and check argument validity." (diff)
parentMerge "Check all lseek calls succeed." (diff)
downloadandroid_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.tar
android_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.tar.gz
android_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.tar.bz2
android_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.tar.lz
android_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.tar.xz
android_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.tar.zst
android_bootable_recovery-34d3a3d074e977cace29797c428795e1de5b3223.zip
Diffstat (limited to 'mtdutils/flash_image.c')
-rw-r--r--mtdutils/flash_image.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mtdutils/flash_image.c b/mtdutils/flash_image.c
index 5657dfc82..36ffa1314 100644
--- a/mtdutils/flash_image.c
+++ b/mtdutils/flash_image.c
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
if (fd < 0) die("error opening %s", argv[2]);
char header[HEADER_SIZE];
- int headerlen = read(fd, header, sizeof(header));
+ int headerlen = TEMP_FAILURE_RETRY(read(fd, header, sizeof(header)));
if (headerlen <= 0) die("error reading %s header", argv[2]);
MtdReadContext *in = mtd_read_partition(partition);
@@ -104,7 +104,7 @@ int main(int argc, char **argv) {
if (wrote != headerlen) die("error writing %s", argv[1]);
int len;
- while ((len = read(fd, buf, sizeof(buf))) > 0) {
+ while ((len = TEMP_FAILURE_RETRY(read(fd, buf, sizeof(buf)))) > 0) {
wrote = mtd_write_data(out, buf, len);
if (wrote != len) die("error writing %s", argv[1]);
}
@@ -125,13 +125,13 @@ int main(int argc, char **argv) {
if (mtd_partition_info(partition, NULL, &block_size, NULL))
die("error getting %s block size", argv[1]);
- if (lseek(fd, headerlen, SEEK_SET) != headerlen)
+ if (TEMP_FAILURE_RETRY(lseek(fd, headerlen, SEEK_SET)) != headerlen)
die("error rewinding %s", argv[2]);
int left = block_size - headerlen;
while (left < 0) left += block_size;
while (left > 0) {
- len = read(fd, buf, left > (int)sizeof(buf) ? (int)sizeof(buf) : left);
+ len = TEMP_FAILURE_RETRY(read(fd, buf, left > (int)sizeof(buf) ? (int)sizeof(buf) : left));
if (len <= 0) die("error reading %s", argv[2]);
if (mtd_write_data(out, buf, len) != len)
die("error writing %s", argv[1]);