diff options
author | Matthew Almond <malmond@fb.com> | 2020-09-28 12:41:22 -0700 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2020-12-10 13:28:07 +0200 |
commit | 3e6bc4d3aee2533c52a05b7ace5c70f877edc188 (patch) | |
tree | be1abd18728f56b15fa93ade46960e4fa16725e1 | |
parent | fa79a7bf0df3ba998c9b82d8144b27c270e9462c (diff) | |
download | rpm-3e6bc4d3aee2533c52a05b7ace5c70f877edc188.tar.gz |
Make fdSeek return 0 on success, -1 on error
This code eliminates a false positive failure when the destination
position is > 2GiB. This is done by changing the contract for `Fseek`.
Now it returns `0` on success instead of an `int` offset.
Care should be used to interpret the result as there is a difference in
semantics between the POSIX `fseek(2)`. Existing code is correct: negative
results are still failures.
(cherry picked from commit d1dee9c00af418004f578a97e9b794676daf6d37)
-rw-r--r-- | rpmio/rpmio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index b7d0faf0d..853897093 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -382,7 +382,7 @@ static ssize_t fdWrite(FDSTACK_t fps, const void * buf, size_t count) static int fdSeek(FDSTACK_t fps, off_t pos, int whence) { - return lseek(fps->fdno, pos, whence); + return (lseek(fps->fdno, pos, whence) == -1) ? -1 : 0; } static int fdClose(FDSTACK_t fps) |