summaryrefslogtreecommitdiff
path: root/lib/init.c
diff options
context:
space:
mode:
authorkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2007-10-25 09:52:46 +0000
committerkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2007-10-25 09:52:46 +0000
commit8a8484b986c0c0b64ee88abf1bfa1d60b172074a (patch)
treeac9c4f67ba62d5fba8219d5b17947771c6de70e3 /lib/init.c
parentd3f2d432be62baa6c85a23e5716ac88f3cd68f8e (diff)
downloadlm-sensors-8a8484b986c0c0b64ee88abf1bfa1d60b172074a.tar.gz
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. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4989 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/init.c')
-rw-r--r--lib/init.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/init.c b/lib/init.c
index 01c68a88..8dd1f3b7 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -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()))