From: Ralph Boehme Date: Thu, 4 Oct 2018 06:51:28 +0000 (+0200) Subject: vfs_fruit: remove unneeded fd argument from ad_convert() X-Git-Tag: samba-4.8.8~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3179bb0a6a95c66f4201d99ea6d6110a524e0b69;p=thirdparty%2Fsamba.git vfs_fruit: remove unneeded fd argument from ad_convert() Use the struct adouble member ad_fd instead of passing it as an argument. Who did that in the first place? :) Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 99cc9ef82b50b57149f71a40d4b22a3fc32a5a97) --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 87329405e71..ab85739daa2 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -1066,8 +1066,7 @@ static bool ad_convert_xattr(struct adouble *ad, * otherwise **/ static int ad_convert(struct adouble *ad, - const struct smb_filename *smb_fname, - int fd) + const struct smb_filename *smb_fname) { int rc = 0; char *map = MAP_FAILED; @@ -1078,7 +1077,8 @@ static int ad_convert(struct adouble *ad, ad_getentrylen(ad, ADEID_RFORK); /* FIXME: direct use of mmap(), vfs_aio_fork does it too */ - map = mmap(NULL, origlen, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + map = mmap(NULL, origlen, PROT_READ|PROT_WRITE, MAP_SHARED, + ad->ad_fd, 0); if (map == MAP_FAILED) { DEBUG(2, ("mmap AppleDouble: %s\n", strerror(errno))); return -1; @@ -1103,7 +1103,7 @@ static int ad_convert(struct adouble *ad, * FIXME: direct ftruncate(), but we don't have a fsp for the * VFS call */ - rc = ftruncate(fd, ad_getentryoff(ad, ADEID_RFORK) + rc = ftruncate(ad->ad_fd, ad_getentryoff(ad, ADEID_RFORK) + ad_getentrylen(ad, ADEID_RFORK)); if (rc != 0) { munmap(map, origlen); @@ -1385,7 +1385,7 @@ static ssize_t ad_read_rsrc_adouble(struct adouble *ad, * appended to the ADEID_FINDERI entry. */ - ret = ad_convert(ad, smb_fname, ad->ad_fd); + ret = ad_convert(ad, smb_fname); if (ret != 0) { DBG_WARNING("Failed to convert [%s]\n", smb_fname->base_name); return len;