diff options
author | Brad King <brad.king@kitware.com> | 2016-05-02 14:48:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-02 14:48:48 (GMT) |
commit | e9bc469b2abcd0ad4cb3ad4bfefbc5ef1f559c1b (patch) | |
tree | 7e84ef0666764bcad5e77c9955c7dcd13413b427 /Utilities/cmlibarchive/libarchive/archive_read_open_file.c | |
parent | db9c40b4f5c9e1aadfe11c89040bad1e3b386162 (diff) | |
parent | 501345e470bb9c5b0cb61aff84bd50ffdd95b92d (diff) | |
download | CMake-e9bc469b2abcd0ad4cb3ad4bfefbc5ef1f559c1b.zip CMake-e9bc469b2abcd0ad4cb3ad4bfefbc5ef1f559c1b.tar.gz CMake-e9bc469b2abcd0ad4cb3ad4bfefbc5ef1f559c1b.tar.bz2 |
Merge branch 'upstream-LibArchive' into update-libarchive
Resolve conflicts in C code by taking their side. Resolve conflicts in
CMake code by integrating the changes.
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) |