Fix more missing log_perror() calls.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 19 Apr 2013 17:28:22 +0000 (19:28 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 19 Apr 2013 17:28:22 +0000 (19:28 +0200)
There's nothing we can do about them, but it's good to report.

Found by Coverity Scan.

stats.cpp

index 8e4443c..4e82d7f 100644 (file)
--- a/stats.cpp
+++ b/stats.cpp
@@ -44,8 +44,12 @@ void StatsThread::do_work()
                fp = fdopen(fd, "w");
                if (fp == NULL) {
                        log_perror("fdopen");
-                       close(fd);
-                       unlink(filename);
+                       if (close(fd) == -1) {
+                               log_perror("close");
+                       }
+                       if (unlink(filename) == -1) {
+                               log_perror(filename);
+                       }
                        free(filename);
                        goto sleep;
                }
@@ -65,13 +69,17 @@ void StatsThread::do_work()
                }
                if (fclose(fp) == EOF) {
                        log_perror("fclose");
-                       unlink(filename);
+                       if (unlink(filename) == -1) {
+                               log_perror(filename);
+                       }
                        free(filename);
                        goto sleep;
                }
                
                if (rename(filename, stats_file.c_str()) == -1) {
-                       log_perror("rename");
+                       if (unlink(filename) == -1) {
+                               log_perror(filename);
+                       }
                        unlink(filename);
                }
                free(filename);