diff options
author | Doug Zongker <dougz@android.com> | 2013-07-10 13:53:15 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-07-10 13:53:15 -0700 |
commit | fbcfad33face5d3b9e6b8cb04379168bceb517df (patch) | |
tree | 09b93388c4ea0bfaf87e41128f4fac238e02773f | |
parent | e352c88fbcfd917f6614597364d2e550aa691e79 (diff) | |
parent | bf4a69ac41696fe78f6cc67b10cf1816186f1c5d (diff) | |
download | bootable_recovery-fbcfad33face5d3b9e6b8cb04379168bceb517df.zip bootable_recovery-fbcfad33face5d3b9e6b8cb04379168bceb517df.tar.gz bootable_recovery-fbcfad33face5d3b9e6b8cb04379168bceb517df.tar.bz2 |
am bf4a69ac: recovery: sleep after writing partition and closing it
* commit 'bf4a69ac41696fe78f6cc67b10cf1816186f1c5d':
recovery: sleep after writing partition and closing it
-rw-r--r-- | applypatch/applypatch.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c index 3f67c32..2c62a06 100644 --- a/applypatch/applypatch.c +++ b/applypatch/applypatch.c @@ -432,7 +432,7 @@ int WriteToPartition(unsigned char* data, size_t len, int attempt; for (attempt = 0; attempt < 10; ++attempt) { - off_t next_sync = start + (1<<20); + size_t next_sync = start + (1<<20); printf("raw write %s attempt %d start at %d\n", partition, attempt+1, start); lseek(fd, start, SEEK_SET); while (start < len) { @@ -487,7 +487,7 @@ int WriteToPartition(unsigned char* data, size_t len, return -1; } } - if (read_count < to_read) { + if ((size_t)read_count < to_read) { printf("short verify read %s at %d: %d %d %s\n", partition, p, read_count, to_read, strerror(errno)); } @@ -519,6 +519,11 @@ int WriteToPartition(unsigned char* data, size_t len, printf("error closing %s (%s)\n", partition, strerror(errno)); return -1; } + // hack: sync and sleep after closing in hopes of getting + // the data actually onto flash. + printf("sleeping after close\n"); + sync(); + sleep(5); break; } } |