]> git.sesse.net Git - cubemap/blobdiff - stats.cpp
Replace all perror() calls with our own log calls.
[cubemap] / stats.cpp
index f5916edf2fb696530fe081cad9eee503457c8a70..71fb4852cef695693c1a91e70ef4a61c2f764cb1 100644 (file)
--- a/stats.cpp
+++ b/stats.cpp
@@ -10,6 +10,7 @@
 #include <vector>
 
 #include "client.h"
+#include "log.h"
 #include "serverpool.h"
 #include "stats.h"
 
@@ -35,14 +36,14 @@ void StatsThread::do_work()
                char *filename = strdup((stats_file + ".new.XXXXXX").c_str());
                fd = mkostemp(filename, O_WRONLY);
                if (fd == -1) {
-                       perror(filename);
+                       log_perror(filename);
                        free(filename);
                        goto sleep;
                }
 
                fp = fdopen(fd, "w");
                if (fp == NULL) {
-                       perror("fdopen");
+                       log_perror("fdopen");
                        close(fd);
                        unlink(filename);
                        free(filename);
@@ -61,14 +62,14 @@ void StatsThread::do_work()
                                (long long unsigned)(client_stats[i].num_loss_events));
                }
                if (fclose(fp) == EOF) {
-                       perror("fclose");
+                       log_perror("fclose");
                        unlink(filename);
                        free(filename);
                        goto sleep;
                }
                
                if (rename(filename, stats_file.c_str()) == -1) {
-                       perror("rename");
+                       log_perror("rename");
                        unlink(filename);
                }
 
@@ -89,7 +90,7 @@ sleep:
                        break;
                }
                if (nfds == -1) {
-                       perror("poll");
+                       log_perror("poll");
                        usleep(100000);
                        continue;
                }