mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
d6ec20c541
commit
1c8c62ce20
1 changed files with 3 additions and 3 deletions
|
@ -232,13 +232,13 @@ static void uemis_info(const char *fmt, ...)
|
||||||
|
|
||||||
static long bytes_available(int file)
|
static long bytes_available(int file)
|
||||||
{
|
{
|
||||||
long result;
|
long result, r2;
|
||||||
long now = lseek(file, 0, SEEK_CUR);
|
long now = lseek(file, 0, SEEK_CUR);
|
||||||
if (now == -1)
|
if (now == -1)
|
||||||
return 0;
|
return 0;
|
||||||
result = lseek(file, 0, SEEK_END);
|
result = lseek(file, 0, SEEK_END);
|
||||||
lseek(file, now, SEEK_SET);
|
r2 = lseek(file, now, SEEK_SET);
|
||||||
if (now == -1 || result == -1)
|
if (now == -1 || result == -1 || r2 == -1)
|
||||||
return 0;
|
return 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue