summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-11 21:56:38 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-11 21:56:38 +0000
commitef6be9db1e7eee0c5ca7bed844a4c8b9d10f25a2 (patch)
tree43faabe7a6d78ac6ef28b0aedff7910fa1bc1e76 /source3
parente6ac820d81e632997726aab5b1937f71138f490a (diff)
downloadsamba-ef6be9db1e7eee0c5ca7bed844a4c8b9d10f25a2.tar.gz
samba-ef6be9db1e7eee0c5ca7bed844a4c8b9d10f25a2.tar.bz2
samba-ef6be9db1e7eee0c5ca7bed844a4c8b9d10f25a2.zip
Merge from HEAD: Patch by Anthony Liguori <aliguor@us.ibm.com> to replace scandir() with portable readdir() calls.
Andrew Bartlett (This used to be commit b9ca0b9ef39442726afd580dc38b6dafce542335)
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_netatalk.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index c869922a4c..b69a900e14 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/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 */