From ea0cfbeadffe6efbee1ecefe9884bc88aff47107 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 10 Feb 2009 20:50:16 +0000 Subject: [PATCH] Report configuration file read errors. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5638 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/error.c | 5 ++++- lib/init.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 87d340ee..51da29bc 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ SVN-HEAD Return a string rather than NULL for unknown errors Skip non-file sysfs entries for speed Fix memory leak in scanner when using flex 2.5.9 or later + Report configuration file read errors lm_sensors.init: Support new format of /etc/sysconfig/lm_sensors (#2246) Drop support for kernels 2.4 and earlier lm_sensors.init.suse: Delete (actual SuSE script is much different) diff --git a/lib/error.c b/lib/error.c index 8ddaa0cf..d626e87e 100644 --- a/lib/error.c +++ b/lib/error.c @@ -58,7 +58,10 @@ const char *sensors_strerror(int errnum) void sensors_default_parse_error(const char *err, int lineno) { - fprintf(stderr, "Error: Line %d: %s\n", lineno, err); + if (lineno) + fprintf(stderr, "Error: Line %d: %s\n", lineno, err); + else + fprintf(stderr, "Error: %s\n", err); } void sensors_default_fatal_error(const char *proc, const char *err) diff --git a/lib/init.c b/lib/init.c index 7c8b55d8..a7b2c7ea 100644 --- a/lib/init.c +++ b/lib/init.c @@ -88,6 +88,9 @@ int sensors_init(FILE *input) goto exit_cleanup; } fclose(input); + } else if (errno != ENOENT) { + sensors_parse_error(strerror(errno), 0); + goto exit_cleanup; } }