]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_fruit: remove unneeded fd argument from ad_convert()
authorRalph Boehme <slow@samba.org>
Thu, 4 Oct 2018 06:51:28 +0000 (08:51 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 18 Oct 2018 11:00:09 +0000 (13:00 +0200)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 99cc9ef82b50b57149f71a40d4b22a3fc32a5a97)

source3/modules/vfs_fruit.c

index 87329405e71e242273f6a19b4698c1533f0cdacc..ab85739daa2165eeffa81d5c262f623658aba398 100644 (file)
@@ -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;