commit 8d9258f39f503d3f1a062c37682f6969bc69ccfd
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Mar 31 07:41:43 2011 +0200
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
Show replies by date