From 171113535983029ab395341c8f8f3c92f320ea1a Mon Sep 17 00:00:00 2001 From: Radek Novacek Date: Fri, 27 Jul 2012 09:35:03 +0200 Subject: Unify logging through all providers Needs to be ported to sfcb/pegasus standard logging, using stderr for now. --- src/fan/Linux_Fan.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/fan') 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 * . */ -#ifndef _XOPEN_SOURCE - //this is for strdup - #define _XOPEN_SOURCE 500 -#endif #include #include #include @@ -28,6 +24,7 @@ #include #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; } -- cgit