From 162161d07d8db58b69e74847e71012c775c4ecca Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 19 Apr 2013 19:28:22 +0200 Subject: [PATCH] Fix more missing log_perror() calls. There's nothing we can do about them, but it's good to report. Found by Coverity Scan. --- stats.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/stats.cpp b/stats.cpp index 8e4443c..4e82d7f 100644 --- 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); -- 2.39.2