summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2017-09-18 16:10:03 +0300
committerPanu Matilainen <pmatilai@redhat.com>2017-10-26 10:40:47 +0300
commit72beb385c3555d8e542ed855e9f98159873c29dc (patch)
tree48f341a113778e6332383050e08d2021ca94359c
parent8bc271482ddfd4bf1e12437e71f208be7884f927 (diff)
downloadrpm-72beb385c3555d8e542ed855e9f98159873c29dc.tar.gz
Fix Ftell() past 2GB on 32bit architectures (RhBug:1492587)
Back in 2011 "somebody" forgot to apply brain when copying the return type of "long" from ftell() to the Ftell() implementations within rpmio (commit 61f5838aa849b8a75f7f08a33c868b518e1ccd44). Fast-forward six years and suddenly TexLive in Fedora no longer builds on 32bit architectures due to that thinko, appearing to be a regression in commit 7d1a303c456ce459cf550e8154fa4b6f29012b05. However that only exposes the inner flaw of Ftell() as the code now relies on values past the initial header range, for which the 2G of "long" has been more than enough on 32bit architectures too. Doh, dude... (cherry picked from commit 90802a894ad75df3a94edbe66a901fca006e65ee)
-rw-r--r--rpmio/rpmio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index 625b06366..e6487c916 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -113,7 +113,7 @@ typedef int (*fdio_close_function_t) (FDSTACK_t fps);
typedef FD_t (*fdio_open_function_t) (const char * path, int flags, mode_t mode);
typedef FD_t (*fdio_fdopen_function_t) (FD_t fd, int fdno, const char * fmode);
typedef int (*fdio_fflush_function_t) (FDSTACK_t fps);
-typedef long (*fdio_ftell_function_t) (FDSTACK_t fps);
+typedef off_t (*fdio_ftell_function_t) (FDSTACK_t fps);
typedef int (*fdio_ferror_function_t) (FDSTACK_t fps);
typedef const char * (*fdio_fstrerr_function_t)(FDSTACK_t fps);
@@ -392,7 +392,7 @@ static FD_t fdOpen(const char *path, int flags, mode_t mode)
return fd;
}
-static long fdTell(FDSTACK_t fps)
+static off_t fdTell(FDSTACK_t fps)
{
return lseek(fps->fdno, 0, SEEK_CUR);
}
@@ -601,7 +601,7 @@ static int gzdClose(FDSTACK_t fps)
return (rc != 0) ? -1 : 0;
}
-static long gzdTell(FDSTACK_t fps)
+static off_t gzdTell(FDSTACK_t fps)
{
off_t pos = -1;
gzFile gzfile = fps->fp;