From: Steinar H. Gunderson Date: Fri, 19 Apr 2013 17:28:22 +0000 (+0200) Subject: Fix more missing log_perror() calls. X-Git-Tag: 1.0.0~68 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=162161d07d8db58b69e74847e71012c775c4ecca;hp=c2be800fa43dff8a3916d6bafaae0e8507b97560 Fix more missing log_perror() calls. There's nothing we can do about them, but it's good to report. Found by Coverity Scan. --- 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);