summaryrefslogtreecommitdiff
path: root/xzlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'xzlib.c')
-rw-r--r--xzlib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xzlib.c b/xzlib.c
index 33c27a26..5470c4e8 100644
--- a/xzlib.c
+++ b/xzlib.c
@@ -133,6 +133,7 @@ static xzFile
xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED)
{
xz_statep state;
+ off_t offset;
/* allocate xzFile structure to return */
state = xmlMalloc(sizeof(xz_state));
@@ -167,9 +168,11 @@ xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED)
}
/* save the current position for rewinding (only if reading) */
- state->start = lseek(state->fd, 0, SEEK_CUR);
- if (state->start == (uint64_t) - 1)
+ offset = lseek(state->fd, 0, SEEK_CUR);
+ if (offset == -1)
state->start = 0;
+ else
+ state->start = offset;
/* initialize stream */
xz_reset(state);