summaryrefslogtreecommitdiffstats
path: root/minzip/SysUtil.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-29 02:24:24 +0200
committerElliott Hughes <enh@google.com>2015-04-30 02:46:43 +0200
commit7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f (patch)
treee2c357667b0e76e6fa5a43c7a7951c872c373e9c /minzip/SysUtil.c
parentMerge "Stop using adb_strtok, and check argument validity." (diff)
downloadandroid_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.tar
android_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.tar.gz
android_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.tar.bz2
android_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.tar.lz
android_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.tar.xz
android_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.tar.zst
android_bootable_recovery-7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f.zip
Diffstat (limited to 'minzip/SysUtil.c')
-rw-r--r--minzip/SysUtil.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/minzip/SysUtil.c b/minzip/SysUtil.c
index ac6f5c33f..b160c9e3d 100644
--- a/minzip/SysUtil.c
+++ b/minzip/SysUtil.c
@@ -27,11 +27,13 @@ static int getFileStartAndLength(int fd, off_t *start_, size_t *length_)
assert(start_ != NULL);
assert(length_ != NULL);
- start = lseek(fd, 0L, SEEK_CUR);
- end = lseek(fd, 0L, SEEK_END);
- (void) lseek(fd, start, SEEK_SET);
+ // TODO: isn't start always 0 for the single call site? just use fstat instead?
- if (start == (off_t) -1 || end == (off_t) -1) {
+ start = TEMP_FAILURE_RETRY(lseek(fd, 0L, SEEK_CUR));
+ end = TEMP_FAILURE_RETRY(lseek(fd, 0L, SEEK_END));
+
+ if (TEMP_FAILURE_RETRY(lseek(fd, start, SEEK_SET)) == -1 ||
+ start == (off_t) -1 || end == (off_t) -1) {
LOGE("could not determine length of file\n");
return -1;
}