diff options
Diffstat (limited to 'libarchive/archive_read_open_file.c')
-rw-r--r-- | libarchive/archive_read_open_file.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libarchive/archive_read_open_file.c b/libarchive/archive_read_open_file.c index 3a33c25..bfe933b 100644 --- a/libarchive/archive_read_open_file.c +++ b/libarchive/archive_read_open_file.c @@ -83,8 +83,9 @@ archive_read_open_FILE(struct archive *a, FILE *f) mine->f = f; /* * If we can't fstat() the file, it may just be that it's not - * a file. (FILE * objects can wrap many kinds of I/O - * streams, some of which don't support fileno()).) + * a file. (On some platforms, FILE * objects can wrap I/O + * streams that don't support fileno()). As a result, fileno() + * should be used cautiously.) */ if (fstat(fileno(mine->f), &st) == 0 && S_ISREG(st.st_mode)) { archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino); @@ -150,7 +151,10 @@ file_skip(struct archive *a, void *client_data, int64_t request) skip = max_skip; } -#if HAVE_FSEEKO +#ifdef __ANDROID__ + /* fileno() isn't safe on all platforms ... see above. */ + if (lseek(fileno(mine->f), skip, SEEK_CUR) < 0) +#elif HAVE_FSEEKO if (fseeko(mine->f, skip, SEEK_CUR) != 0) #elif HAVE__FSEEKI64 if (_fseeki64(mine->f, skip, SEEK_CUR) != 0) |