summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_unlink.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-26 13:18:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:04:48 -0500
commitee7fa4812c8366588b77d6be91b8666a275ba92c (patch)
treefc554a8460e46223b321bb4d50ea8dc5bd80c71d /source4/ntvfs/posix/pvfs_unlink.c
parentf493f7be97e9200c28dc69d73e64044140743e0b (diff)
downloadsamba-ee7fa4812c8366588b77d6be91b8666a275ba92c.tar.gz
samba-ee7fa4812c8366588b77d6be91b8666a275ba92c.tar.bz2
samba-ee7fa4812c8366588b77d6be91b8666a275ba92c.zip
r3262: - new pvfs_dirlist code that reopens the directory between search
calls. This is needed to allow for "new files appear during a search" behaviour - pvfs now passes RAW-SEARCH (This used to be commit 0d98f7653a1d58510a6cd4c2ac6c5e05c541109c)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_unlink.c')
-rw-r--r--source4/ntvfs/posix/pvfs_unlink.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c
index 74614d194a..ff02d77613 100644
--- a/source4/ntvfs/posix/pvfs_unlink.c
+++ b/source4/ntvfs/posix/pvfs_unlink.c
@@ -79,9 +79,10 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_dir *dir;
NTSTATUS status;
- uint32_t i, total_deleted=0;
+ uint32_t total_deleted=0;
struct pvfs_filename *name;
const char *fname;
+ uint_t ofs;
/* resolve the cifs name to a posix name */
status = pvfs_resolve_name(pvfs, req, unl->in.pattern, 0, &name);
@@ -98,22 +99,17 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
- dir = talloc_p(req, struct pvfs_dir);
- if (dir == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
/* get list of matching files */
- status = pvfs_list_start(pvfs, name, dir);
+ status = pvfs_list_start(pvfs, name, req, &dir);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
status = NT_STATUS_NO_SUCH_FILE;
- for (i=0;
- (fname = pvfs_list_next(dir, i));
- i++) {
+ ofs = 0;
+
+ while ((fname = pvfs_list_next(dir, &ofs))) {
/* this seems to be a special case */
if ((unl->in.attrib & FILE_ATTRIBUTE_DIRECTORY) &&
(strcmp(fname, ".") == 0 ||
@@ -121,7 +117,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OBJECT_NAME_INVALID;
}
- status = pvfs_unlink_one(pvfs, req, dir->unix_path, fname, unl->in.attrib);
+ status = pvfs_unlink_one(pvfs, req, pvfs_list_unix_path(dir), fname, unl->in.attrib);
if (NT_STATUS_IS_OK(status)) {
total_deleted++;
}