summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-11 21:54:36 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-11 21:54:36 +0000
commit7836b9a58d158a54a7326b3de5d2fa757a9bb5b6 (patch)
treee08bc75c123cfd72f587782a153e799c189672a3
parentfa4961b1fc9f0ab2a1c32c56c6200d86a61093c9 (diff)
downloadsamba-7836b9a58d158a54a7326b3de5d2fa757a9bb5b6.tar.gz
samba-7836b9a58d158a54a7326b3de5d2fa757a9bb5b6.tar.xz
samba-7836b9a58d158a54a7326b3de5d2fa757a9bb5b6.zip
Patch from Anthony Liguori <aliguor@us.ibm.com> to remove scandir() portability
madness. Andrew Bartlett
-rw-r--r--source/modules/vfs_netatalk.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/source/modules/vfs_netatalk.c b/source/modules/vfs_netatalk.c
index c869922a4c7..b69a900e144 100644
--- a/source/modules/vfs_netatalk.c
+++ b/source/modules/vfs_netatalk.c
@@ -161,27 +161,26 @@ static void atalk_add_to_list(name_compare_entry **list)
static void atalk_rrmdir(TALLOC_CTX *ctx, char *path)
{
- int n;
char *dpath;
- struct dirent **namelist;
+ struct dirent *dent = 0;
+ DIR *dir;
if (!path) return;
- n = scandir(path, &namelist, 0, alphasort);
- if (n < 0) {
- return;
- } else {
- while (n --) {
- if (strcmp(namelist[n]->d_name, ".") == 0 ||
- strcmp(namelist[n]->d_name, "..") == 0)
- continue;
- if (!(dpath = talloc_asprintf(ctx, "%s/%s",
- path, namelist[n]->d_name)))
- continue;
- atalk_unlink_file(dpath);
- free(namelist[n]);
- }
+ dir = opendir(path);
+ if (!dir) return;
+
+ while (NULL != (dent = readdir(dir))) {
+ if (strcmp(dent->d_name, ".") == 0 ||
+ strcmp(dent->d_name, "..") == 0)
+ continue;
+ if (!(dpath = talloc_asprintf(ctx, "%s/%s",
+ path, dent->d_name)))
+ continue;
+ atalk_unlink_file(dpath);
}
+
+ closedir(dir);
}
/* Disk operations */