From de00b0aad40375ea779e57d5db7ac4103c310ecc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 25 Oct 2007 09:52:46 +0000 Subject: [PATCH] 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 --- CHANGES | 1 + lib/init.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 8498c867..536aefaa 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN HEAD libsensors: Add a default configuration file Fix memory leaks on initialization error + Make the configuration file optional sensord: Reload config on SIGHUP rather than automatically No default configuration file name sensors: Fix file handle leak on library initialization error 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()))