Skip to contentSkip to conversation

Make the configuration file optional

PATCH In review Jean Delvare 1 participant 1 message Oct 24, 2007 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 Make the configuration file optional

Make the configuration file optional. Although in most cases it's not very useful to use libsensors without a configuration file, I fail to see the rationale for making a configuration file mandatory.

---
 lib/init.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
lib/init.c +6 -6
@@ -49,14 +49,14 @@ int sensors_init(FILE *input)
 	} else {
 		/* No configuration provided, use default */
 		input = fopen(DEFAULT_CONFIG_FILE, "r");
-		if (!input)
-			goto exit_cleanup;
-		if (sensors_scanner_init(input) ||
-		    sensors_yyparse()) {
+		if (input) {
+			if (sensors_scanner_init(input) ||
+			    sensors_yyparse()) {
+				fclose(input);
+				goto exit_cleanup;
+			}
 			fclose(input);
-			goto exit_cleanup;
 		}
-		fclose(input);
 	}
 
 	if ((res = sensors_substitute_busses()))
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors