Patchwork [01/13] nsdbparams: Improve certfile debugging messages

login
register
mail settings
Submitter Chuck Lever
Date Jan. 8, 2013, 5:27 p.m.
Message ID <20130108172714.65133.85057.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/210448/
State Accepted
Headers show

Comments

Chuck Lever - Jan. 8, 2013, 5:27 p.m.
Report specific error conditions when reading a certfile fails.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 src/libnsdb/nsdb.c      |    2 ++
 src/nsdbparams/update.c |    8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

Patch

diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c
index 20d9e55..3f10c4d 100644
--- a/src/libnsdb/nsdb.c
+++ b/src/libnsdb/nsdb.c
@@ -515,6 +515,8 @@  nsdb_read_certfile(const char *pathname, char **certdata,
 		goto out;
 	}
 
+	xlog(D_CALL, "%s: Successfully read %s", __func__, pathname);
+
 	(void)close(fd);
 	*certdata = buf;
 	*certlen = stb.st_size;
diff --git a/src/nsdbparams/update.c b/src/nsdbparams/update.c
index d073552..c436876 100644
--- a/src/nsdbparams/update.c
+++ b/src/nsdbparams/update.c
@@ -363,9 +363,11 @@  nsdbparams_update(const char *progname, int argc, char **argv)
 			goto out;
 		}
 
-		if (nsdb_read_certfile(certfile, &secdata.data,
-				&secdata.len) != FEDFS_OK) {
-			xlog(L_ERROR, "Failed to read certfile");
+		retval = nsdb_read_certfile(certfile,
+						&secdata.data, &secdata.len);
+		if (retval != FEDFS_OK) {
+			xlog(L_ERROR, "Failed to read certfile: %s",
+					nsdb_display_fedfsstatus(retval));
 			goto out;
 		}
 	}