From 8e46497089b4752e5a910e1451d7af44e9d85cfc Mon Sep 17 00:00:00 2001
From: noryb009 <noryb009@hotmail.com>
Date: Fri, 3 Jan 2014 00:39:34 -0500
Subject: [PATCH] Coverity CID 1032247 and 1032248: unchecked return
The return value of fseeko should be checked. If below 0, an
error occured, and errno is set to indicate the error.
---
src/kits/storage/FileIO.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/kits/storage/FileIO.cpp b/src/kits/storage/FileIO.cpp
index 439f836..ec23d7b 100644
a
|
b
|
BFileIO::ReadAt(off_t position, void* buffer, size_t size)
|
55 | 55 | ssize_t result = BFileIO::Read(buffer, size); |
56 | 56 | |
57 | 57 | // seek back |
58 | | fseeko(fFile, oldPosition, SEEK_SET); |
| 58 | if (fseeko(fFile, oldPosition, SEEK_SET) < 0) |
| 59 | return errno; |
59 | 60 | |
60 | 61 | return result; |
61 | 62 | } |
… |
… |
BFileIO::WriteAt(off_t position, const void* buffer, size_t size)
|
73 | 74 | ssize_t result = BFileIO::Write(buffer, size); |
74 | 75 | |
75 | 76 | // seek back |
76 | | fseeko(fFile, oldPosition, SEEK_SET); |
| 77 | if (fseeko(fFile, oldPosition, SEEK_SET) < 0) |
| 78 | return errno; |
77 | 79 | |
78 | 80 | return result; |
79 | 81 | } |