summaryrefslogtreecommitdiffstats
path: root/src/fan/Linux_Fan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fan/Linux_Fan.c')
-rw-r--r--src/fan/Linux_Fan.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/fan/Linux_Fan.c b/src/fan/Linux_Fan.c
index 738920b..9826ba2 100644
--- a/src/fan/Linux_Fan.c
+++ b/src/fan/Linux_Fan.c
@@ -14,10 +14,6 @@
* along with cmpiLinux_FanProvider. If not, see
* <http://www.gnu.org/licenses/>.
*/
-#ifndef _XOPEN_SOURCE
- //this is for strdup
- #define _XOPEN_SOURCE 500
-#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -28,6 +24,7 @@
#include <sensors/error.h>
#include "Linux_Fan.h"
+#include "globals.h"
#define MAX_CHIP_NAME_LENGTH 200
@@ -108,13 +105,13 @@ static cim_fan_error_t reload_config_file(char const * fp) {
if (fp) {
if (!(config_file = fopen(fp, "r"))) {
- fprintf(stderr, "Cound not open config file \"%s\": %s\n",
+ error("Cound not open config file \"%s\": %s\n",
fp, strerror(errno));
}
}
err = sensors_init(config_file);
if (err) {
- fprintf(stderr, "sensors_init: %s\n", sensors_strerror(err));
+ error("sensors_init: %s\n", sensors_strerror(err));
if (config_file) fclose(config_file);
}else {
if (config_file) fclose(config_file);
@@ -245,7 +242,7 @@ static struct cim_fan * _load_fan_data( sensors_chip_name const *chip
if ((f = calloc(1, sizeof(struct cim_fan)))) {
if (!(chip_name = sprintf_chip_name(chip))) {
- fprintf(stderr, "could not get chip name\n");
+ error("could not get chip name\n");
goto lab_err_free_fan;
}
if (!(f->chip_name = strdup(chip_name))) {
@@ -254,7 +251,7 @@ static struct cim_fan * _load_fan_data( sensors_chip_name const *chip
}
f->sys_path = chip->path;
if (!(f->name = sensors_get_label(chip, feature))) {
- fprintf(stderr, "could not get fan name for chip: %s\n",
+ error("could not get fan name for chip: %s\n",
f->chip_name);
goto lab_err_chip_name;
}