projects
/
cubemap
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5cc8cd7
)
Check the return value of fclose() in config.cpp.
author
Steinar H. Gunderson
<sgunderson@bigfoot.com>
Thu, 24 Apr 2014 22:41:44 +0000
(
00:41
+0200)
committer
Steinar H. Gunderson
<sgunderson@bigfoot.com>
Thu, 24 Apr 2014 22:41:44 +0000
(
00:41
+0200)
It's unclear to me exactly how this could fail for a read-only file,
but it's good practice nevertheless.
Found by Coverity Scan.
config.cpp
patch
|
blob
|
history
diff --git
a/config.cpp
b/config.cpp
index
4a3dfb3
..
f1b05c1
100644
(file)
--- a/
config.cpp
+++ b/
config.cpp
@@
-132,7
+132,10
@@
bool read_config(const string &filename, vector<ConfigLine> *lines)
lines->push_back(line);
}
- fclose(fp);
+ if (fclose(fp) == EOF) {
+ log_perror(filename.c_str());
+ return false;
+ }
return true;
}