[PATCH 5/6] Make the configuration file optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

--- lm-sensors-3.orig/lib/init.c	2007-10-20 16:28:57.000000000 +0200
+++ lm-sensors-3/lib/init.c	2007-10-20 16:29:41.000000000 +0200
@@ -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()))


-- 
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux