wmgtemp: Autodetect sensors.conf instead of providing default value.
Patch by Aurelien Jarno <aurel32@debian.org>. From http://sources.debian.net/src/wmgtemp/1.1-3/debian/patches/sensors.conf.patch/
This commit is contained in:
parent
68b2a5b9e6
commit
84b7716e3d
|
@ -663,12 +663,16 @@ int init_sensors() {
|
||||||
FILE *config_file;
|
FILE *config_file;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
if (rc_config) {
|
||||||
config_file = fopen(rc_config, "r");
|
config_file = fopen(rc_config, "r");
|
||||||
|
|
||||||
if(config_file == NULL) {
|
if(config_file == NULL) {
|
||||||
fprintf(stderr, "Error opening %s\n", rc_config);
|
fprintf(stderr, "Error opening %s\n", rc_config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
config_file = NULL; /* Use libsensors default */
|
||||||
|
}
|
||||||
|
|
||||||
res = sensors_init(config_file);
|
res = sensors_init(config_file);
|
||||||
|
|
||||||
|
@ -677,7 +681,7 @@ int init_sensors() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fclose(config_file))
|
if(config_file && fclose(config_file))
|
||||||
perror("Error closing sensors config");
|
perror("Error closing sensors config");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -688,7 +692,7 @@ void display_usage() {
|
||||||
"Usage: wmgtemp [options]\n" \
|
"Usage: wmgtemp [options]\n" \
|
||||||
"Options:\n" \
|
"Options:\n" \
|
||||||
" -S, --sensorconf=PATH Specify sensors config file PATH\n" \
|
" -S, --sensorconf=PATH Specify sensors config file PATH\n" \
|
||||||
" [Default: /etc/sensors.conf]\n" \
|
" [Default: autodetect]\n" \
|
||||||
" -s, --scale=SCALE Display temperatures in SCALE\n" \
|
" -s, --scale=SCALE Display temperatures in SCALE\n" \
|
||||||
" SCALE=kelvin, fahrenheit\n" \
|
" SCALE=kelvin, fahrenheit\n" \
|
||||||
" [Default: celcius]\n" \
|
" [Default: celcius]\n" \
|
||||||
|
@ -950,9 +954,6 @@ int process_config(int argc, char **argv) {
|
||||||
if(rc_chip != NULL) {
|
if(rc_chip != NULL) {
|
||||||
sensor_chip = strdup(rc_chip);
|
sensor_chip = strdup(rc_chip);
|
||||||
}
|
}
|
||||||
if(rc_config == NULL) {
|
|
||||||
rc_config = "/etc/sensors.conf";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rc_graph != NULL) {
|
if(rc_graph != NULL) {
|
||||||
if(!strncmp(rc_graph, "l", 1)) {
|
if(!strncmp(rc_graph, "l", 1)) {
|
||||||
|
|
Loading…
Reference in a new issue