|
Panu Matilainen |
822c26 |
From 90802a894ad75df3a94edbe66a901fca006e65ee Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
822c26 |
Message-Id: <90802a894ad75df3a94edbe66a901fca006e65ee.1505741312.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
822c26 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
822c26 |
Date: Mon, 18 Sep 2017 16:10:03 +0300
|
|
Panu Matilainen |
822c26 |
Subject: [PATCH] Fix Ftell() past 2GB on 32bit architectures (RhBug:1492587)
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
Back in 2011 "somebody" forgot to apply brain when copying the return
|
|
Panu Matilainen |
822c26 |
type of "long" from ftell() to the Ftell() implementations within rpmio
|
|
Panu Matilainen |
822c26 |
(commit 61f5838aa849b8a75f7f08a33c868b518e1ccd44).
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
Fast-forward six years and suddenly TexLive in Fedora no longer builds
|
|
Panu Matilainen |
822c26 |
on 32bit architectures due to that thinko, appearing to be a regression
|
|
Panu Matilainen |
822c26 |
in commit 7d1a303c456ce459cf550e8154fa4b6f29012b05. However that only
|
|
Panu Matilainen |
822c26 |
exposes the inner flaw of Ftell() as the code now relies on values
|
|
Panu Matilainen |
822c26 |
past the initial header range, for which the 2G of "long" has been more
|
|
Panu Matilainen |
822c26 |
than enough on 32bit architectures too.
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
Doh, dude...
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
|
|
Panu Matilainen |
822c26 |
index 57e610185..d8b884085 100644
|
|
Panu Matilainen |
822c26 |
--- a/rpmio/rpmio.c
|
|
Panu Matilainen |
822c26 |
+++ b/rpmio/rpmio.c
|
|
Panu Matilainen |
822c26 |
@@ -124,7 +124,7 @@ typedef int (*fdio_close_function_t) (FDSTACK_t fps);
|
|
Panu Matilainen |
822c26 |
typedef FD_t (*fdio_open_function_t) (const char * path, int flags, mode_t mode);
|
|
Panu Matilainen |
822c26 |
typedef FD_t (*fdio_fdopen_function_t) (FD_t fd, int fdno, const char * fmode);
|
|
Panu Matilainen |
822c26 |
typedef int (*fdio_fflush_function_t) (FDSTACK_t fps);
|
|
Panu Matilainen |
822c26 |
-typedef long (*fdio_ftell_function_t) (FDSTACK_t fps);
|
|
Panu Matilainen |
822c26 |
+typedef off_t (*fdio_ftell_function_t) (FDSTACK_t fps);
|
|
Panu Matilainen |
822c26 |
typedef int (*fdio_ferror_function_t) (FDSTACK_t fps);
|
|
Panu Matilainen |
822c26 |
typedef const char * (*fdio_fstrerr_function_t)(FDSTACK_t fps);
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
@@ -410,7 +410,7 @@ static FD_t fdOpen(const char *path, int flags, mode_t mode)
|
|
Panu Matilainen |
822c26 |
return fd;
|
|
Panu Matilainen |
822c26 |
}
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
-static long fdTell(FDSTACK_t fps)
|
|
Panu Matilainen |
822c26 |
+static off_t fdTell(FDSTACK_t fps)
|
|
Panu Matilainen |
822c26 |
{
|
|
Panu Matilainen |
822c26 |
return lseek(fps->fdno, 0, SEEK_CUR);
|
|
Panu Matilainen |
822c26 |
}
|
|
Panu Matilainen |
822c26 |
@@ -619,7 +619,7 @@ static int gzdClose(FDSTACK_t fps)
|
|
Panu Matilainen |
822c26 |
return (rc != 0) ? -1 : 0;
|
|
Panu Matilainen |
822c26 |
}
|
|
Panu Matilainen |
822c26 |
|
|
Panu Matilainen |
822c26 |
-static long gzdTell(FDSTACK_t fps)
|
|
Panu Matilainen |
822c26 |
+static off_t gzdTell(FDSTACK_t fps)
|
|
Panu Matilainen |
822c26 |
{
|
|
Panu Matilainen |
822c26 |
off_t pos = -1;
|
|
Panu Matilainen |
822c26 |
gzFile gzfile = fps->fp;
|
|
Panu Matilainen |
822c26 |
--
|
|
Panu Matilainen |
822c26 |
2.13.5
|
|
Panu Matilainen |
822c26 |
|