diff --git a/CHANGES b/CHANGES index f457672e..63e8646e 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ SVN HEAD sensord: Reload config on SIGHUP rather than automatically sensors: Fix file handle leak on library initialization error Handle the case where voltage measurements aren't available + No default configuration file name sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips sensors-detect-stat.pl: Handle alternative chip lists diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6acfa668..54bfbe59 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -39,7 +39,6 @@ #define PROGRAM "sensors" #define VERSION LM_VERSION -#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" static int do_sets, do_raw, hide_adapter; @@ -54,9 +53,8 @@ static void print_short_help(void) static void print_long_help(void) { printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM); - printf(" -c, --config-file Specify a config file (default: %s)\n", - DEFAULT_CONFIG_FILE); - puts(" -h, --help Display this help text\n" + puts(" -c, --config-file Specify a config file\n" + " -h, --help Display this help text\n" " -s, --set Execute `set' statements (root only)\n" " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" " -A, --no-adapter Do not show adapter for each chip\n" @@ -88,15 +86,20 @@ static int read_config_file(const char *config_file_name) FILE *config_file; int err; - if (!strcmp(config_file_name, "-")) - config_file = stdin; - else - config_file = fopen(config_file_name, "r"); + if (config_file_name) { + if (!strcmp(config_file_name, "-")) + config_file = stdin; + else + config_file = fopen(config_file_name, "r"); - if (!config_file) { - fprintf(stderr, "Could not open config file\n"); - perror(config_file_name); - return 1; + if (!config_file) { + fprintf(stderr, "Could not open config file\n"); + perror(config_file_name); + return 1; + } + } else { + /* Use libsensors default */ + config_file = NULL; } err = sensors_init(config_file); @@ -106,7 +109,7 @@ static int read_config_file(const char *config_file_name) return 1; } - if (fclose(config_file) == EOF) + if (config_file && fclose(config_file) == EOF) perror(config_file_name); return 0; @@ -239,7 +242,7 @@ static void print_bus_list(void) int main(int argc, char *argv[]) { int c, res, i, error, do_bus_list; - const char *config_file_name = DEFAULT_CONFIG_FILE; + const char *config_file_name = NULL; struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 index 0a5525a3..f359bbdb 100644 --- a/prog/sensors/sensors.1 +++ b/prog/sensors/sensors.1 @@ -22,7 +22,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH sensors 1 "September 2007" "lm-sensors 3" "Linux User's Manual" +.TH sensors 1 "October 2007" "lm-sensors 3" "Linux User's Manual" .SH NAME sensors \- print sensors information .SH SYNOPSIS @@ -50,9 +50,9 @@ is used to generate bus statements suitable for the configuration file. .SH OPTIONS .IP "-c config-file" -Specify a configuration file. If no file is specified, `/etc/sensors.conf' -is used. Use `-c /dev/null' to temporarily disable this default configuration -file. +Specify a configuration file. If no file is specified, the libsensors +default configuration file is used. Use `-c /dev/null' to temporarily +disable this default configuration file. .IP -h Print a help text and exit. .IP -s