From: Steinar H. Gunderson Date: Thu, 24 Apr 2014 22:41:44 +0000 (+0200) Subject: Check the return value of fclose() in config.cpp. X-Git-Tag: 1.1.0~13 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=98b8cb22fe22f6a8b46a47cd5fa00dcf2bcd6fd5;hp=5cc8cd703a637e276c2595953878fd9561592bfa Check the return value of fclose() in config.cpp. 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. --- diff --git a/config.cpp b/config.cpp index 4a3dfb3..f1b05c1 100644 --- a/config.cpp +++ b/config.cpp @@ -132,7 +132,10 @@ bool read_config(const string &filename, vector *lines) lines->push_back(line); } - fclose(fp); + if (fclose(fp) == EOF) { + log_perror(filename.c_str()); + return false; + } return true; }