#include "bool.h"
#include "config.h"
#include <plog.h>
+#include <pmutex.h>
#include "ptime.h"
#include "slog.h"
str = malloc(64);
- if (strftime(str, 64, "%s", <)) {
+ if (strftime(str, 64, "%s", <))
return str;
- } else {
- free(str);
- return NULL;
- }
+
+ free(str);
+ return NULL;
}
static char *get_default_path()
free(dir);
return path;
- } else {
- log_warn(_("HOME variable not set."));
- return strdup(DEFAULT_FILENAME);
}
+
+ log_warn(_("HOME variable not set."));
+ return strdup(DEFAULT_FILENAME);
}
static bool slog_open(const char *path, struct psensor **sensors)
bool first_call;
if (!file) {
- log_err(_("Sensor log file not open."));
- return ;
+ log_debug(_("Sensor log file not open."));
+ return;
}
gettimeofday(&tv, NULL);
{
while (1) {
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
- pthread_mutex_lock(sensors_mutex);
+ pmutex_lock(sensors_mutex);
slog_write_sensors(sensors);
- pthread_mutex_unlock(sensors_mutex);
+ pmutex_unlock(sensors_mutex);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
sleep(period);
}