diff options
author | Brad King <brad.king@kitware.com> | 2016-05-04 14:25:19 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-05-04 14:25:19 (GMT) |
commit | 858aa5f9af8bdf096f6985eda468903ca266dc8f (patch) | |
tree | a743884bef917e0988387fb3c7e67a67558c4dfe /Utilities/cmlibarchive/libarchive/archive_read_open_file.c | |
parent | cc4626430742fce1f5ea1bcecb1b961ca37513f3 (diff) | |
parent | 59d28b2849b13ca275b28d5f8b689b28dae4ac28 (diff) | |
download | CMake-858aa5f9af8bdf096f6985eda468903ca266dc8f.zip CMake-858aa5f9af8bdf096f6985eda468903ca266dc8f.tar.gz CMake-858aa5f9af8bdf096f6985eda468903ca266dc8f.tar.bz2 |
Merge topic 'update-libarchive'
59d28b28 libarchive: Drop early use of crypto library
fa425910 Utilities/Release: Define NTDDI_VERSION for Windows binaries
e9bc469b Merge branch 'upstream-LibArchive' into update-libarchive
db9c40b4 Merge branch 'upstream-LibArchive' into update-libarchive
b2675cde libarchive: Remove CMake-specific README
501345e4 LibArchive 2016-04-30 (167e97be)
91e6da10 Add script to update LibArchive from upstream
fc8fc40f LibArchive 2015-10-21 (3bfe5f1f)
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_read_open_file.c')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_open_file.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_open_file.c b/Utilities/cmlibarchive/libarchive/archive_read_open_file.c index 3a33c25..bfe933b 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_open_file.c +++ b/Utilities/cmlibarchive/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) |