mirror of https://github.com/BOINC/boinc.git
Lib: check return value
This does not break compatibility because the current caller CLIENT_STATE::write_state_file() is opening the file again for each retry if MFILE::close() fails. fixes CID 34502 found by Coverity
This commit is contained in:
parent
317460e4f8
commit
4654bdc234
|
@ -148,10 +148,13 @@ int MFILE::puts(const char* p) {
|
|||
return n;
|
||||
}
|
||||
|
||||
// This is closing the file even if it couldn't flush it.
|
||||
// The caller needs to check the return value and open the file again before the next retry.
|
||||
//
|
||||
int MFILE::close() {
|
||||
int retval = 0;
|
||||
if (f) {
|
||||
flush();
|
||||
retval = flush();
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue