|
|
ab825f |
From 7ae16d6bd37abdcc0430fbb1b25a0f821a60c234 Mon Sep 17 00:00:00 2001
|
|
|
ab825f |
From: Matthew Almond <malmond@fb.com>
|
|
|
ab825f |
Date: Mon, 28 Sep 2020 12:41:22 -0700
|
|
|
ab825f |
Subject: [PATCH] Make fdSeek return 0 on success, -1 on error
|
|
|
ab825f |
|
|
|
ab825f |
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.
|
|
|
ab825f |
---
|
|
|
ab825f |
rpmio/rpmio.c | 2 +-
|
|
|
ab825f |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
ab825f |
|
|
|
ab825f |
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
|
|
|
ab825f |
index 10a28a923..9f4a60aa1 100644
|
|
|
ab825f |
--- a/rpmio/rpmio.c
|
|
|
ab825f |
+++ b/rpmio/rpmio.c
|
|
|
ab825f |
@@ -382,7 +382,7 @@ static ssize_t fdWrite(FDSTACK_t fps, const void * buf, size_t count)
|
|
|
ab825f |
|
|
|
ab825f |
static int fdSeek(FDSTACK_t fps, off_t pos, int whence)
|
|
|
ab825f |
{
|
|
|
ab825f |
- return lseek(fps->fdno, pos, whence);
|
|
|
ab825f |
+ return (lseek(fps->fdno, pos, whence) == -1) ? -1 : 0;
|
|
|
ab825f |
}
|
|
|
ab825f |
|
|
|
ab825f |
static int fdClose(FDSTACK_t fps)
|