X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=stats.cpp;h=b2bca75970f800a6cf3f21517e243e3aed89cacd;hp=8e4443cf14d4f2ce478c702a1bbb0127fa8f461b;hb=71fc5575037bead8b6e927a1fffd199e4fc4514b;hpb=5cd46e39b4063d94f6dc559ae350beeb8406a8f9 diff --git a/stats.cpp b/stats.cpp index 8e4443c..b2bca75 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,14 +69,18 @@ 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"); - unlink(filename); + if (unlink(filename) == -1) { + log_perror(filename); + } } free(filename);