pvfs_unlink: move stream logic into pvfs_unlink_one()
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2008 08:41:41 +0000 (09:41 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 25 Feb 2008 07:03:44 +0000 (08:03 +0100)
metze

source/ntvfs/posix/pvfs_unlink.c

index 0763a4e48c4cf4cf925779a28194e04a2329e5e0..bda4014beec16c8a701347d0e6d8a36188350627 100644 (file)
 #include "system/dir.h"
 
 
-/*
-  unlink a stream
- */
-static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, 
-                                  struct ntvfs_request *req,
-                                  union smb_unlink *unl,
-                                  struct pvfs_filename *name)
-{
-       NTSTATUS status;
-
-       /* make sure its matches the given attributes */
-       status = pvfs_match_attrib(pvfs, name,
-                                  unl->unlink.in.attrib, 0);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       status = pvfs_can_delete(pvfs, req, name, NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       return pvfs_stream_delete(pvfs, name, -1);
-}
-
-
 /*
   unlink a file
 */
@@ -106,6 +80,14 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
                return status;
        }
 
+       if (name->stream_name) {
+               if (!name->stream_exists) {
+                       return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               }
+
+               return pvfs_stream_delete(pvfs, name, -1);
+       }
+
        return pvfs_unlink_file(pvfs, name);
 }
 
@@ -141,14 +123,6 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
                return NT_STATUS_FILE_IS_A_DIRECTORY;
        }
 
-       if (name->stream_name) {
-               if (!name->stream_exists) {
-                       return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-               }
-
-               return pvfs_unlink_stream(pvfs, req, unl, name);
-       }
-
        if (!name->has_wildcard) {
                return pvfs_unlink_one(pvfs, req, unl, name);
        }