summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_open_fd.c
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2011-03-21 16:56:03 -0400
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2011-03-21 16:56:03 -0400
commit573b5b57d0e7251294710044567e6a782c001088 (patch)
tree8549e903eac255dd270839b7e26f9cfe01a288de /libarchive/archive_read_open_fd.c
parent49b77aca9a1220e412d46f574d6e01df643b2bd1 (diff)
downloadlibarchive-573b5b57d0e7251294710044567e6a782c001088.tar.gz
Some plaform will not use max_skip and so its initialization is unneeded.
Found with Clang Static Analyzer. SVN-Revision: 3048
Diffstat (limited to 'libarchive/archive_read_open_fd.c')
-rw-r--r--libarchive/archive_read_open_fd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libarchive/archive_read_open_fd.c b/libarchive/archive_read_open_fd.c
index 6e1e3b3d..5e865245 100644
--- a/libarchive/archive_read_open_fd.c
+++ b/libarchive/archive_read_open_fd.c
@@ -129,14 +129,17 @@ file_skip(struct archive *a, void *client_data, int64_t request)
off_t skip = (off_t)request;
off_t old_offset, new_offset;
int skip_bits = sizeof(skip) * 8 - 1; /* off_t is a signed type. */
- int64_t max_skip = (((int64_t)1 << (skip_bits - 1)) - 1) * 2 + 1;
if (!mine->use_lseek)
return (0);
/* Reduce a request that would overflow the 'skip' variable. */
- if ((sizeof(request) > sizeof(skip)) && (request > max_skip))
- skip = max_skip;
+ if (sizeof(request) > sizeof(skip)) {
+ int64_t max_skip =
+ (((int64_t)1 << (skip_bits - 1)) - 1) * 2 + 1;
+ if (request > max_skip)
+ skip = max_skip;
+ }
/* Reduce request to the next smallest multiple of block_size */
request = (request / mine->block_size) * mine->block_size;