Changeset 5169
- Timestamp:
- 04/08/08 16:50:13 (3 months ago)
- Files:
-
- lm-sensors/branches/lm-sensors-3.0.0/CHANGES (modified) (1 diff)
- lm-sensors/branches/lm-sensors-3.0.0/lib/init.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/branches/lm-sensors-3.0.0/CHANGES
r5134 r5169 4 4 SVN-HEAD 5 5 libsensors: Use __func__ instead of __FUNCTION__ 6 Parse the configuration file in C locale 6 7 sensors-detect: Add SMSC SCH5027D detection 7 8 Do not access I/O ports on PPC lm-sensors/branches/lm-sensors-3.0.0/lib/init.c
r5163 r5169 20 20 */ 21 21 22 #include <locale.h> 22 23 #include <stdlib.h> 23 24 #include <stdio.h> 25 #include <string.h> 24 26 #include <errno.h> 25 27 #include "sensors.h" … … 35 37 #define ALT_CONFIG_FILE ETCDIR "/sensors.conf" 36 38 39 /* Wrapper around sensors_yyparse(), which clears the locale so that 40 the decimal numbers are always parsed properly. */ 41 static int sensors_parse(void) 42 { 43 int res; 44 char *locale; 45 46 /* Remember the current locale and clear it */ 47 locale = setlocale(LC_ALL, NULL); 48 if (locale) { 49 locale = strdup(locale); 50 setlocale(LC_ALL, "C"); 51 } 52 53 res = sensors_yyparse(); 54 55 /* Restore the old locale */ 56 if (locale) { 57 setlocale(LC_ALL, locale); 58 free(locale); 59 } 60 61 return res; 62 } 63 37 64 int sensors_init(FILE *input) 38 65 { … … 48 75 if (input) { 49 76 if (sensors_scanner_init(input) || 50 sensors_ yyparse())77 sensors_parse()) 51 78 goto exit_cleanup; 52 79 } else { … … 57 84 if (input) { 58 85 if (sensors_scanner_init(input) || 59 sensors_ yyparse()) {86 sensors_parse()) { 60 87 fclose(input); 61 88 goto exit_cleanup;
