(7) Event check_return:
Calling function "fstat(isc->fd, &s)" without checking return value.
This library function may fail and return an error code.
196 fstat(isc->fd, &s);
Resolve by adding if (fstat->isc->fd, &s) < 0)
---
libxkutil/infostore.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libxkutil/infostore.c b/libxkutil/infostore.c
index dd1e38c..a88b586 100644
--- a/libxkutil/infostore.c
+++ b/libxkutil/infostore.c
@@ -193,7 +193,10 @@ static struct infostore_ctx *_generic_infostore_open(char *filename)
goto err;
}
- fstat(isc->fd, &s);
+ if (fstat(isc->fd, &s) < 0) {
+ CU_DEBUG("Failed to fstat infostore");
+ goto err;
+ }
if (s.st_size == 0)
isc->doc = new_xml();
else
--
1.8.1.4