libsensors: Fix wrong behaviour in multiple
PATCH 1/1 libsensors: Fix wrong behaviour in multiple
The support for multiple configuration files causes a fatal error if /etc/sensors.d does not exist.
That shouldn't be treated as an error. This patch fixes that.
lib/init.c +6 -1
@@ -124,10 +124,15 @@ static int add_config_from_dir(const chastruct dirent **namelist; count =scandir (dir, &namelist, config_file_filter, alphasort); +/* Do not return an error if directory does not exist or is empty. */ if (count <0 ) { +if (errno =ENOENT ) +return 0 ; +sensors_parse_error_wfn (strerror (errno),NULL ,0 );return -SENSORS_ERR_PARSE ; - } + }else if (!count) +return 0 ;for (res =0 , i =0 ; !res && i < count; i++) {int len;
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [Patch] libsensors: Fix wrong behaviour in
Hi Andre,
Quoted 4 lines · Andre Prendel
The support for multiple configuration files causes a fatal error if
/etc/sensors.ddoes not exist.That shouldn't be treated as an error. This patch fixes that.
You are perfectly right, what you propose is how I intended to implement the thing but apparently there was a loss of signal between the idea and its implementation.
lib/init.c static int add_config_from_dir(const cha · line 131
Quoted 11 lines
lib/init.c +4
-0@@ -124,10 +124,15 @@ static int add_config_from_dir(const chastruct dirent **namelist; count =scandir (dir, &namelist, config_file_filter, alphasort); +/* Do not return an error if directory does not exist or is empty. */ if (count <0 ) { +if (errno =ENOENT ) +return 0 ; +
I'm applying this right now.
lib/init.c static int add_config_from_dir(const cha · line 135
Quoted 5 lines
lib/init.c +2
-1sensors_parse_error_wfn (strerror (errno),NULL ,0 );return -SENSORS_ERR_PARSE ; - } + }else if (!count) +return 0 ;
This second test doesn't seem needed, the following code is a no-op if count = 0, isn't it?
lib/init.c static int add_config_from_dir(const cha · line 138
Quoted 3 lines
lib/init.c +0
-0for (res =0 , i =0 ; !res && i < count; i++) {int len;
Thanks for your contribution!
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [Patch] libsensors: Fix wrong behaviour in
In reply to Andre PrendelQuoted 1 line · Jean Delvare
Hi Andre,
Hi Jean!
Quoted 10 lines · Andre Prendel
Quoted 4 lines
The support for multiple configuration files causes a fatal error if
/etc/sensors.ddoes not exist.That shouldn't be treated as an error. This patch fixes that.
You are perfectly right, what you propose is how I intended to implement the thing but apparently there was a loss of signal between the idea and its implementation.
I know this problem. :)
Quoted 15 lines
lib/init.c static int add_config_from_dir(const cha · line 131
Quoted 12 lines
lib/init.c +4
-0@@ -124,10 +124,15 @@ static int add_config_from_dir(const chastruct dirent **namelist; count =scandir (dir, &namelist, config_file_filter, alphasort); +/* Do not return an error if directory does not exist or is empty. */ if (count <0 ) { +if (errno =ENOENT ) +return 0 ; +I'm applying this right now.
Quoted 8 lines
lib/init.c static int add_config_from_dir(const cha · line 135
Quoted 5 lines
lib/init.c +2
-1sensors_parse_error_wfn (strerror (errno),NULL ,0 );return -SENSORS_ERR_PARSE ; - } + }else if (!count) +return 0 ;This second test doesn't seem needed, the following code is a no-op if count = 0, isn't it?
Yes it is. That's just my programming style. So you see at first view what will happen if the directory is empty. You have not to examine the loop.
Quoted 6 lines
lib/init.c static int add_config_from_dir(const cha · line 138
Quoted 4 lines
lib/init.c +0
-0for (res =0 , i =0 ; !res && i < count; i++) {int len;Thanks for your contribution!
Thanks
Andre
Quoted 3 lines
Signature · 2 lines
-- Jean Delvare
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors