summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-27 07:07:35 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-27 07:35:46 -0700
commit1c8c62ce20e50b84a72228970a8761d5c4e8302d (patch)
tree5b152f6ca10837307a8b28371c35d4170972650b
parentd6ec20c5412d4120cd93fc5cbf9768478d4bf45b (diff)
downloadsubsurface-1c8c62ce20e50b84a72228970a8761d5c4e8302d.tar.gz
Cleanup: consider lseek return value
This seems excessively unlikely to actually fail. SEEK_END works, but SEEK_SET fails? Oh well. Belts and suspenders. Found by Coverity. Fixes CID 45039 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/uemis-downloader.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index 180115271..18aa2451b 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -232,13 +232,13 @@ static void uemis_info(const char *fmt, ...)
static long bytes_available(int file)
{
- long result;
+ long result, r2;
long now = lseek(file, 0, SEEK_CUR);
if (now == -1)
return 0;
result = lseek(file, 0, SEEK_END);
- lseek(file, now, SEEK_SET);
- if (now == -1 || result == -1)
+ r2 = lseek(file, now, SEEK_SET);
+ if (now == -1 || result == -1 || r2 == -1)
return 0;
return result;
}