diff options
author | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
commit | 11b8179a57e675c6672cbe649c655230ae3e9744 (patch) | |
tree | 2919c366d51e154e65279156fef5b4f97b8fd2f9 /arch/linux/common/samba.h | |
parent | 720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 (diff) |
Import Upstream version 0.4.2.1
Diffstat (limited to 'arch/linux/common/samba.h')
-rw-r--r-- | arch/linux/common/samba.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/linux/common/samba.h b/arch/linux/common/samba.h index 5f5ecbe5..7c7d8bb7 100644 --- a/arch/linux/common/samba.h +++ b/arch/linux/common/samba.h @@ -24,7 +24,7 @@ scan_samba_shared_directories(void) GError *error = NULL; gchar **groups; gchar *smbconf; - gsize length; + gsize length = -1; gint i = 0; if (smb_shares_list) { @@ -33,9 +33,10 @@ scan_samba_shared_directories(void) keyfile = g_key_file_new(); - if (!g_file_get_contents("/etc/samba/smb.conf", &smbconf, &length, &error)) { + if (!g_file_get_contents("/etc/samba/smb.conf", &smbconf, &length, &error) || length == 0) { smb_shares_list = g_strdup("Cannot open /etc/samba/smb.conf=\n"); - g_error_free(error); + if (error) + g_error_free(error); goto cleanup; } @@ -45,7 +46,8 @@ scan_samba_shared_directories(void) if (!g_key_file_load_from_data(keyfile, smbconf, length, 0, &error)) { smb_shares_list = g_strdup("Cannot parse smb.conf=\n"); - g_error_free(error); + if (error) + g_error_free(error); goto cleanup; } |