From e8d953aa7ed0c16beb1b03a05d16cb23dd85e198 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 11 Jul 2013 12:09:05 -0700 Subject: recovery: more cargo-cult programming Add O_DIRECT|O_SYNC when opening partitions for write. Change-Id: I9825ad8e60fba87e482f8abc5593d6f54a1e3a1c --- applypatch/applypatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'applypatch') diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c index 2c62a06..60e26ed 100644 --- a/applypatch/applypatch.c +++ b/applypatch/applypatch.c @@ -424,7 +424,7 @@ int WriteToPartition(unsigned char* data, size_t len, { size_t start = 0; int success = 0; - int fd = open(partition, O_RDWR); + int fd = open(partition, O_RDWR | O_DIRECT | O_SYNC); if (fd < 0) { printf("failed to open %s: %s\n", partition, strerror(errno)); return -1; @@ -433,7 +433,7 @@ int WriteToPartition(unsigned char* data, size_t len, for (attempt = 0; attempt < 10; ++attempt) { size_t next_sync = start + (1<<20); - printf("raw write %s attempt %d start at %d\n", partition, attempt+1, start); + printf("raw O_DIRECT write %s attempt %d start at %d\n", partition, attempt+1, start); lseek(fd, start, SEEK_SET); while (start < len) { size_t to_write = len - start; -- cgit v1.1