1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

pvfs_unlink: move stream logic into pvfs_unlink_one()

metze
(This used to be commit 438032e12f)
This commit is contained in:
Stefan Metzmacher 2008-02-22 09:41:41 +01:00
parent 58745900d3
commit 599901c139

View File

@ -24,32 +24,6 @@
#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);
}