summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2019-05-24 11:54:51 +0200
committerKarolin Seeger <kseeger@samba.org>2019-06-21 07:56:20 +0000
commit015586a42274edc210d71fdc8d9158ecdd59d7b9 (patch)
tree0bbcb9baebb8f12c851322c6bb18bea8e0e8b081
parent42e6d4d4b5ebec4346797214e5f70c5720369867 (diff)
downloadsamba-015586a42274edc210d71fdc8d9158ecdd59d7b9.tar.gz
vfs_fruit: use fsp and remove mmap in ad_convert_xattr()
No need to mmap() anyway, the xattr data is already available in ad->ad_data. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13968 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 4ff7ea0e0312c737aefd350f7b8fbed4c8602325)
-rw-r--r--source3/modules/vfs_fruit.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 08125169a71..e63ed959f35 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -1061,10 +1061,7 @@ static bool ad_convert_xattr(vfs_handle_struct *handle,
bool *converted_xattr)
{
static struct char_mappings **string_replace_cmaps = NULL;
- char *map = MAP_FAILED;
- size_t maplen;
uint16_t i;
- ssize_t len;
int saved_errno = 0;
NTSTATUS status;
int rc;
@@ -1088,17 +1085,6 @@ static bool ad_convert_xattr(vfs_handle_struct *handle,
TALLOC_FREE(mappings);
}
- maplen = ad_getentryoff(ad, ADEID_RFORK) +
- ad_getentrylen(ad, ADEID_RFORK);
-
- /* FIXME: direct use of mmap(), vfs_aio_fork does it too */
- map = mmap(NULL, maplen, PROT_READ|PROT_WRITE, MAP_SHARED,
- ad->ad_fsp->fh->fd, 0);
- if (map == MAP_FAILED) {
- DBG_ERR("mmap AppleDouble: %s\n", strerror(errno));
- return false;
- }
-
for (i = 0; i < ad->adx_header.adx_num_attrs; i++) {
struct ad_xattr_entry *e = &ad->adx_entries[i];
char *mapped_name = NULL;
@@ -1170,7 +1156,7 @@ static bool ad_convert_xattr(vfs_handle_struct *handle,
}
nwritten = SMB_VFS_PWRITE(fsp,
- map + e->adx_offset,
+ ad->ad_data + e->adx_offset,
e->adx_length,
0);
if (nwritten == -1) {
@@ -1198,9 +1184,10 @@ static bool ad_convert_xattr(vfs_handle_struct *handle,
goto fail;
}
- len = sys_pwrite(ad->ad_fsp->fh->fd, ad->ad_data, AD_DATASZ_DOT_UND, 0);
- if (len != AD_DATASZ_DOT_UND) {
- DBG_ERR("%s: bad size: %zd\n", smb_fname->base_name, len);
+ rc = ad_fset(handle, ad, ad->ad_fsp);
+ if (rc != 0) {
+ DBG_ERR("ad_fset on [%s] failed: %s\n",
+ fsp_str_dbg(ad->ad_fsp), strerror(errno));
ok = false;
goto fail;
}
@@ -1214,12 +1201,6 @@ static bool ad_convert_xattr(vfs_handle_struct *handle,
ok = true;
fail:
- rc = munmap(map, maplen);
- if (rc != 0) {
- DBG_ERR("munmap failed: %s\n", strerror(errno));
- return false;
- }
-
return ok;
}