From: Tim Kientzle Date: Fri, 18 Nov 2011 05:24:32 +0000 (-0500) Subject: Push int64_t down a bit; there's still a problem here if off_t is short. X-Git-Tag: v3.0.1b~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ebbc3f5442bb458ad4383fce2ce9373a8f99da8;p=thirdparty%2Flibarchive.git Push int64_t down a bit; there's still a problem here if off_t is short. SVN-Revision: 3804 --- diff --git a/libarchive/archive_read_open_filename.c b/libarchive/archive_read_open_filename.c index c2eea4157..bb3db4c10 100644 --- a/libarchive/archive_read_open_filename.c +++ b/libarchive/archive_read_open_filename.c @@ -77,7 +77,7 @@ struct read_file_data { static int file_close(struct archive *, void *); static ssize_t file_read(struct archive *, void *, const void **buff); static int64_t file_skip(struct archive *, void *, int64_t request); -static off_t file_skip_lseek(struct archive *, void *, off_t request); +static int64_t file_skip_lseek(struct archive *, void *, int64_t request); int archive_read_open_file(struct archive *a, const char *filename, @@ -279,12 +279,15 @@ file_read(struct archive *a, void *client_data, const void **buff) * seek request here and then actually performed the seek at the * top of the read callback above. */ -static off_t -file_skip_lseek(struct archive *a, void *client_data, off_t request) +static int64_t +file_skip_lseek(struct archive *a, void *client_data, int64_t request) { struct read_file_data *mine = (struct read_file_data *)client_data; off_t old_offset, new_offset; + /* We use off_t here because lseek() is declared that way. */ + + /* TODO: Deal with case where off_t isn't 64 bits. */ if ((old_offset = lseek(mine->fd, 0, SEEK_CUR)) >= 0 && (new_offset = lseek(mine->fd, request, SEEK_CUR)) >= 0) return (new_offset - old_offset); @@ -298,7 +301,6 @@ file_skip_lseek(struct archive *a, void *client_data, off_t request) /* If the input is corrupted or truncated, fail. */ if (mine->filename[0] == '\0') - /* Shouldn't happen; lseek() on stdin should raise ESPIPE. */ archive_set_error(a, errno, "Error seeking in stdin"); else archive_set_error(a, errno, "Error seeking in '%s'",