From ee7fa4812c8366588b77d6be91b8666a275ba92c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 26 Oct 2004 13:18:34 +0000 Subject: 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) --- source4/ntvfs/posix/pvfs_unlink.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'source4/ntvfs/posix/pvfs_unlink.c') 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++; } -- cgit