From: Francesco Chemolli Date: Sun, 12 Jul 2015 18:01:57 +0000 (+0200) Subject: Fix error-testing condition in log_file_daemon.cc (CID 1256161) X-Git-Tag: merge-candidate-3-v1~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a307b25255efe16486091bf5c030f83d6175348;p=thirdparty%2Fsquid.git Fix error-testing condition in log_file_daemon.cc (CID 1256161) An error condition check would assume that ferror(3) returns negative values if error bit is set. According to documentation, the only guarantee is that it returns nonzero in case of error. --- diff --git a/helpers/log_daemon/file/log_file_daemon.cc b/helpers/log_daemon/file/log_file_daemon.cc index 890c25645d..cd1c65fb30 100644 --- a/helpers/log_daemon/file/log_file_daemon.cc +++ b/helpers/log_daemon/file/log_file_daemon.cc @@ -119,7 +119,7 @@ main(int argc, char *argv[]) /* try to detect the 32-bit file too big write error and rotate */ int err = ferror(fp); clearerr(fp); - if (err < 0) { + if (err != 0) { /* file too big - recover by rotating the logs and starting a new one. * out of device space - recover by rotating and hoping that rotation count drops a big one. */