diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-10-28 02:36:01 +0000 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-10-28 02:36:01 +0000 |
commit | 22b94483a3bcecf038ab531eefb023d1a578cfd8 (patch) | |
tree | 753c754e4049763b209278568d5fa98ce902afcc /hardinfo2/arch/linux/common | |
parent | 789ca8b0d19be16b1ed7386b9b214cd2b66b0498 (diff) |
Cleanups
Diffstat (limited to 'hardinfo2/arch/linux/common')
-rw-r--r-- | hardinfo2/arch/linux/common/samba.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/hardinfo2/arch/linux/common/samba.h b/hardinfo2/arch/linux/common/samba.h index 5f5ecbe5..7c7d8bb7 100644 --- a/hardinfo2/arch/linux/common/samba.h +++ b/hardinfo2/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; } |