summaryrefslogtreecommitdiff
path: root/arch/linux/common/samba.h
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:35 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:35 -0500
commit720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 (patch)
tree26a8d91183787418455f65c2bb44ed641800dad3 /arch/linux/common/samba.h
parent854292407779593a401a1d5ce71add51880fa84f (diff)
Import Upstream version 0.4.1
Diffstat (limited to 'arch/linux/common/samba.h')
-rw-r--r--arch/linux/common/samba.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/arch/linux/common/samba.h b/arch/linux/common/samba.h
index 538659a6..5f5ecbe5 100644
--- a/arch/linux/common/samba.h
+++ b/arch/linux/common/samba.h
@@ -16,24 +16,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-static gchar *shares_list = NULL;
+static gchar *smb_shares_list = NULL;
void
-scan_shared_directories(void)
+scan_samba_shared_directories(void)
{
GKeyFile *keyfile;
GError *error = NULL;
gchar **groups;
gchar *smbconf;
gsize length;
+ gint i = 0;
- if (shares_list) {
- g_free(shares_list);
+ if (smb_shares_list) {
+ g_free(smb_shares_list);
}
keyfile = g_key_file_new();
if (!g_file_get_contents("/etc/samba/smb.conf", &smbconf, &length, &error)) {
- shares_list = g_strdup("Cannot open /etc/samba/smb.conf=\n");
+ smb_shares_list = g_strdup("Cannot open /etc/samba/smb.conf=\n");
g_error_free(error);
goto cleanup;
}
@@ -43,24 +44,23 @@ scan_shared_directories(void)
if (*_smbconf == ';') *_smbconf = '\0';
if (!g_key_file_load_from_data(keyfile, smbconf, length, 0, &error)) {
- shares_list = g_strdup("Cannot parse smb.conf=\n");
+ smb_shares_list = g_strdup("Cannot parse smb.conf=\n");
g_error_free(error);
goto cleanup;
}
- shares_list = g_strdup("");
+ smb_shares_list = g_strdup("");
groups = g_key_file_get_groups(keyfile, NULL);
- gchar **_groups = groups;
- while (*groups) {
- if (g_key_file_has_key(keyfile, *groups, "path", NULL) &&
- g_key_file_has_key(keyfile, *groups, "available", NULL)) {
+ while (groups[i]) {
+ if (g_key_file_has_key(keyfile, groups[i], "path", NULL) &&
+ g_key_file_has_key(keyfile, groups[i], "available", NULL)) {
- gchar *available = g_key_file_get_string(keyfile, *groups, "available", NULL);
+ gchar *available = g_key_file_get_string(keyfile, groups[i], "available", NULL);
if (g_str_equal(available, "yes")) {
- gchar *path = g_key_file_get_string(keyfile, *groups, "path", NULL);
- shares_list = g_strconcat(shares_list, *groups, "=",
+ gchar *path = g_key_file_get_string(keyfile, groups[i], "path", NULL);
+ smb_shares_list = g_strconcat(smb_shares_list, groups[i], "=",
path, "\n", NULL);
g_free(path);
}
@@ -68,10 +68,10 @@ scan_shared_directories(void)
g_free(available);
}
- *groups++;
+ i++;
}
- g_strfreev(_groups);
+ g_strfreev(groups);
cleanup:
g_key_file_free(keyfile);