diff mbox series

[02/15] storage: Log a message on network file parse errors

Message ID 20220616000231.1966008-2-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [01/15] netconfig: Fix address format validation | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Andrew Zaborowski June 16, 2022, 12:02 a.m. UTC
Most users of storage_network_open don't log errors when the function
returns a NULL and fall back to defaults (empty l_settings).
storage_network_open() itself only logs errors if the flie is encrypted.
Now also log an error when l_settings_load_from_file() fails to help track
down potential syntax errors.
---
 src/storage.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Denis Kenzior June 17, 2022, 7:09 p.m. UTC | #1
On 6/15/22 19:02, Andrew Zaborowski wrote:
> Most users of storage_network_open don't log errors when the function
> returns a NULL and fall back to defaults (empty l_settings).
> storage_network_open() itself only logs errors if the flie is encrypted.
> Now also log an error when l_settings_load_from_file() fails to help track
> down potential syntax errors.
> ---
>   src/storage.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 

Hmm, I'm still not sure logging l_errors inside storage.c is the right approach. 
  I see this crept in when encrypted profiles were merged.

Anyway, I went ahead and applied this, but I wonder if we need to fix this to 
return proper error codes at some point.

Applied, thanks.

Regards,
-Denis
Denis Kenzior June 17, 2022, 7:09 p.m. UTC | #2
On 6/15/22 19:02, Andrew Zaborowski wrote:
> Most users of storage_network_open don't log errors when the function
> returns a NULL and fall back to defaults (empty l_settings).
> storage_network_open() itself only logs errors if the flie is encrypted.
> Now also log an error when l_settings_load_from_file() fails to help track
> down potential syntax errors.
> ---
>   src/storage.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 

Hmm, I'm still not sure logging l_errors inside storage.c is the right approach. 
  I see this crept in when encrypted profiles were merged.

Anyway, I went ahead and applied this, but I wonder if we need to fix this to 
return proper error codes at some point.

Applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/storage.c b/src/storage.c
index 2100d08d..77be36c8 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -597,8 +597,10 @@  struct l_settings *storage_network_open(enum security type, const char *ssid)
 
 	settings = l_settings_new();
 
-	if (!l_settings_load_from_file(settings, path))
+	if (!l_settings_load_from_file(settings, path)) {
+		l_error("Error loading %s", path);
 		goto error;
+	}
 
 	if (type != SECURITY_NONE && !storage_decrypt(settings, path, ssid))
 		goto error;