From: Jeremy Allison Date: Thu, 12 Sep 2019 21:00:24 +0000 (-0700) Subject: s3: VFS: vfs_streams_xattr. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~630 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7e763ef0558473a81cecd12abc0d50dd77c0b9f;p=thirdparty%2Fsamba.git s3: VFS: vfs_streams_xattr. Implement unlinkat(). Note this isn't identical to unlink() as this must cope with (flags & AT_REMOVEDIR), which is identical to rmdir(). It calls either unlink or rmdir depending on the flags parameter. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index dcb1eb54975..ea2f902502b 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -594,6 +594,24 @@ static int streams_xattr_unlink(vfs_handle_struct *handle, return ret; } +static int streams_xattr_unlinkat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + int ret; + if (flags & AT_REMOVEDIR) { + ret = SMB_VFS_NEXT_UNLINKAT(handle, + dirfsp, + smb_fname, + flags); + } else { + ret = streams_xattr_unlink(handle, + smb_fname); + } + return ret; +} + static int streams_xattr_renameat(vfs_handle_struct *handle, files_struct *srcfsp, const struct smb_filename *smb_fname_src, @@ -1661,6 +1679,7 @@ static struct vfs_fn_pointers vfs_streams_xattr_fns = { .pwrite_send_fn = streams_xattr_pwrite_send, .pwrite_recv_fn = streams_xattr_pwrite_recv, .unlink_fn = streams_xattr_unlink, + .unlinkat_fn = streams_xattr_unlinkat, .renameat_fn = streams_xattr_renameat, .ftruncate_fn = streams_xattr_ftruncate, .fallocate_fn = streams_xattr_fallocate,