[PATCH] fix bug in previous change

Jim Meyering jim at meyering.net
Thu Mar 31 05:49:49 UTC 2011


I forgot to run "make check" after the "trivial" change.
That trivial change broke replication.

>From 8d9258f39f503d3f1a062c37682f6969bc69ccfd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Thu, 31 Mar 2011 07:41:43 +0200
Subject: [PATCH] fix bug in previous change

* rest.c (recheck_replication): Don't return early just because
the first attempt to find policy failed.  Remove now-unnecessary
if-block.
---
 rest.c |   29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/rest.c b/rest.c
index 41acc53..25e9847 100644
--- a/rest.c
+++ b/rest.c
@@ -373,36 +373,27 @@ recheck_replication (my_state *ms, char *policy)
 	if (!policy) {
 		DPRINTF("fetching policy for %s/%s\n",ms->bucket,ms->key);
 		int rc = meta_get_value(ms->bucket,ms->key, "_policy", &policy);
-		if (rc) {
+		if (rc)
 			error (0, rc, _("failed to get policy for %s/%s"),
 			       ms->bucket,ms->key);
-			return;
-		}
 	}

 	if (!policy) {
 		DPRINTF("  inheriting policy from %s\n",ms->bucket);
 		int rc = meta_get_value(ms->bucket, "_default",
 					"_policy", &policy);
-		if (rc) {
+		if (rc || !policy)
 			error (0, rc, _("failed to get default policy"));
-			return;
-		}
 	}

-	if (policy) {
-		char fixed[MAX_FIELD_LEN];
-		DPRINTF("  implementing policy %s\n",policy);
-		/*
-		 * Can't use ms->url here because it might be a bucket POST
-		 * and in that case ms->url points to the bucket.
-		 */
-		snprintf(fixed,sizeof(fixed),"%s/%s",ms->bucket,ms->key);
-		replicate(fixed,0,policy,ms);
-	}
-	else {
-		DPRINTF("  could not find a policy anywhere!\n");
-	}
+	char fixed[MAX_FIELD_LEN];
+	DPRINTF("  implementing policy %s\n",policy);
+	/*
+	 * Can't use ms->url here because it might be a bucket POST
+	 * and in that case ms->url points to the bucket.
+	 */
+	snprintf(fixed,sizeof(fixed),"%s/%s",ms->bucket,ms->key);
+	replicate(fixed,0,policy,ms);
 }

 static int
--
1.7.4.2.662.gcbd0


More information about the iwhd-devel mailing list