[PATCH] vfs_fruit: return value of ad_pack in vfs_fruit.c

Ralph Böhme slow at samba.org
Tue Oct 6 09:20:58 UTC 2015


Hi

attached is a small patch for vfs_fruit, thanks to Uri who spotted
this!

-slow
-------------- next part --------------
From 3317e024b73d012fd07240e75b93beee8522683f Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 27 Sep 2015 12:11:31 +0200
Subject: [PATCH] vfs_fruit: return value of ad_pack in vfs_fruit.c

ad_pack() in vfs_fruit.c returns false on failure and 0 on success -
i.e. return value is interpreted as success even when it fails.

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/modules/vfs_fruit.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index c90699f..8393366 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -567,7 +567,7 @@ static bool ad_pack(struct adouble *ad)
 	}
 	RSSVAL(ad->ad_data, ADEDOFF_NENTRIES, nent);
 
-	return 0;
+	return true;
 }
 
 /**
@@ -949,8 +949,9 @@ static ssize_t ad_header_read_rsrc(struct adouble *ad, const char *path)
 			/*
 			 * Can't use ad_write() because we might not have a fsp
 			 */
-			rc = ad_pack(ad);
-			if (rc != 0) {
+			ok = ad_pack(ad);
+			if (!ok) {
+				rc = -1;
 				goto exit;
 			}
 			/* FIXME: direct sys_pwrite(), don't have an fsp */
@@ -1211,10 +1212,11 @@ static int ad_write(struct adouble *ad, const char *path)
 {
 	int rc = 0;
 	ssize_t len;
+	bool ok;
 
-	rc = ad_pack(ad);
-	if (rc != 0) {
-		goto exit;
+	ok = ad_pack(ad);
+	if (!ok) {
+		return -1;
 	}
 
 	switch (ad->ad_type) {
-- 
2.1.0



More information about the samba-technical mailing list