]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix error-testing condition in log_file_daemon.cc (CID 1256161)
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 12 Jul 2015 18:01:57 +0000 (20:01 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 12 Jul 2015 18:01:57 +0000 (20:01 +0200)
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.

helpers/log_daemon/file/log_file_daemon.cc

index 890c25645d3cedf45fd053b2843e190312abcb20..cd1c65fb30d9694a592f41ab454b98f9fc265a12 100644 (file)
@@ -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.
                      */