vfs_fruit: fix resource fork length calculation
authorRalph Boehme <rb@sernet.de>
Mon, 15 Sep 2014 11:51:41 +0000 (13:51 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 25 Sep 2014 19:19:12 +0000 (21:19 +0200)
Don't add the AppleDouble header size to the resource fork size.

Signed-off-by: Ralph Boehme <rb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_fruit.c

index bdb068a7e2605a75497131692c1f0b633156e6f5..37027459f504ca9a4f44a7a7bb5ed946c720f3be 100644 (file)
@@ -2311,7 +2311,7 @@ static ssize_t fruit_pwrite(vfs_handle_struct *handle,
                handle, fsp);
        struct fruit_config_data *config = NULL;
        AfpInfo *ai = NULL;
-       ssize_t len, new_rfork_size;
+       ssize_t len;
        char *name = NULL;
        char *tmp_base_name = NULL;
        NTSTATUS status;
@@ -2377,16 +2377,12 @@ static ssize_t fruit_pwrite(vfs_handle_struct *handle,
                if (config->rsrc == FRUIT_RSRC_ADFILE) {
                        rc = ad_read(ad, name);
                        if (rc == -1) {
-                               rc = -1;
                                goto exit;
                        }
                        rc = 0;
 
-                       new_rfork_size = len + offset
-                               + ad_getentryoff(ad, ADEID_RFORK);
-                       if (new_rfork_size > ad_getentrylen(ad, ADEID_RFORK)) {
-                               ad_setentrylen(ad, ADEID_RFORK,
-                                              new_rfork_size);
+                       if ((len + offset) > ad_getentrylen(ad, ADEID_RFORK)) {
+                               ad_setentrylen(ad, ADEID_RFORK, len + offset);
                                rc = ad_write(ad, name);
                        }
                }