[PATCH] avoid more useless diagnostics: "failed to get policy..."

Jim Meyering jim at meyering.net
Mon Jun 6 18:04:07 UTC 2011


Avoid another 20K useless diagnostics.

>From 5e923cc8a0e91c6fee9ce4e17b340016d80f7c64 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 6 Jun 2011 19:12:12 +0200
Subject: [PATCH] avoid more useless diagnostics: "failed to get policy..."

* meta.cpp (GetValue): In the common case, return ENOENT, rather
than ENXIO ("no such device or address"), to distinguish from
another use of ENXIO.  So we can...
* rest.c (recheck_replication): ...suppress a useless diagnostic.
Most replication checks would evoke a message like this:
"iwhd: failed to get policy for b-39/obj: No such device or address"
There was no error there.  Just absence of policy.  We shouldn't
be polluting logs with non-errors like that.
---
 meta.cpp |    2 +-
 rest.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta.cpp b/meta.cpp
index b88b8c3..a699863 100644
--- a/meta.cpp
+++ b/meta.cpp
@@ -370,7 +370,7 @@ RepoMeta::GetValue (const char *bucket, const char *key, const char *mkey,
 	bo = curs->next();
 	data = bo.getStringField(mkey);
 	if (!data || !*data) {
-		return ENXIO;
+		return ENOENT;
 	}

 	*mvalue = strdup(data);
diff --git a/rest.c b/rest.c
index d3d8617..9c39673 100644
--- a/rest.c
+++ b/rest.c
@@ -380,7 +380,7 @@ 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 && rc != ENOENT)
 			error (0, rc, _("failed to get policy for %s/%s"),
 			       ms->bucket,ms->key);
 	}
--
1.7.6.rc0.254.gf37de


More information about the iwhd-devel mailing list