summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-07-28 18:23:05 -0700
committerJoe Onorato <joeo@android.com>2009-07-28 18:30:15 -0700
commit1b96719b327c16db024836f91fcba54335e5a96b (patch)
tree9a946445f3d3a264d5a4c643950a31e7525cf60e /libs/utils
parentd4357fec9ccf875ecccddc7bb22b34efda438f5c (diff)
downloadframeworks_native-1b96719b327c16db024836f91fcba54335e5a96b.zip
frameworks_native-1b96719b327c16db024836f91fcba54335e5a96b.tar.gz
frameworks_native-1b96719b327c16db024836f91fcba54335e5a96b.tar.bz2
Fix the IOException in wallpaper restore -- the padding isn't required at the end.
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/BackupData.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp
index be04777..c51d989 100644
--- a/libs/utils/BackupData.cpp
+++ b/libs/utils/BackupData.cpp
@@ -196,6 +196,7 @@ BackupDataReader::Status()
} else { \
m_status = errno; \
} \
+ LOGD("CHECK_SIZE failed with at line %d m_status='%s'", __LINE__, strerror(m_status)); \
return m_status; \
} \
} while(0)
@@ -203,6 +204,7 @@ BackupDataReader::Status()
do { \
status_t err = skip_padding(); \
if (err != NO_ERROR) { \
+ LOGD("SKIP_PADDING FAILED at line %d", __LINE__); \
m_status = err; \
return err; \
} \
@@ -218,10 +220,19 @@ BackupDataReader::ReadNextHeader(bool* done, int* type)
int amt;
- // No error checking here, in case we're at the end of the stream. Just let read() fail.
- skip_padding();
+ amt = skip_padding();
+ if (amt == EIO) {
+ *done = true;
+ return NO_ERROR;
+ }
+ else if (amt != NO_ERROR) {
+ return amt;
+ }
amt = read(m_fd, &m_header, sizeof(m_header));
*done = m_done = (amt == 0);
+ if (*done) {
+ return NO_ERROR;
+ }
CHECK_SIZE(amt, sizeof(m_header));
m_pos += sizeof(m_header);
if (type) {