From 9f9c933c16abacb2d0aa7bc7faa5b1ddac61b0e5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 7 Nov 2007 19:06:30 +0100 Subject: [PATCH] Fix dbwrap debug output --- source/lib/dbwrap_ctdb.c | 5 +++-- source/lib/dbwrap_tdb.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/lib/dbwrap_ctdb.c b/source/lib/dbwrap_ctdb.c index c5cb8d0aad1..90d0b260c54 100644 --- a/source/lib/dbwrap_ctdb.c +++ b/source/lib/dbwrap_ctdb.c @@ -86,7 +86,8 @@ static int db_ctdb_record_destr(struct db_record* data) data->private_data, struct db_ctdb_rec); DEBUG(10, (DEBUGLEVEL > 10 - ? "Unlocking db %u key %s\n" : "Unlocking db %u key %20s\n", + ? "Unlocking db %u key %s\n" + : "Unlocking db %u key %.20s\n", (int)crec->ctdb_ctx->db_id, hex_encode(data, (unsigned char *)data->key.dptr, data->key.dsize))); @@ -141,7 +142,7 @@ again: char *keystr = hex_encode(result, key.dptr, key.dsize); DEBUG(10, (DEBUGLEVEL > 10 ? "Locking db %u key %s\n" - : "Locking db %u key %20s\n", + : "Locking db %u key %.20s\n", (int)crec->ctdb_ctx->db_id, keystr)); TALLOC_FREE(keystr); } diff --git a/source/lib/dbwrap_tdb.c b/source/lib/dbwrap_tdb.c index 24462d67892..593a8ac1d6f 100644 --- a/source/lib/dbwrap_tdb.c +++ b/source/lib/dbwrap_tdb.c @@ -32,7 +32,7 @@ static int db_tdb_record_destr(struct db_record* data) talloc_get_type_abort(data->private_data, struct db_tdb_ctx); DEBUG(10, (DEBUGLEVEL > 10 - ? "Unlocking key %s\n" : "Unlocking key %20s\n", + ? "Unlocking key %s\n" : "Unlocking key %.20s\n", hex_encode(data, (unsigned char *)data->key.dptr, data->key.dsize))); @@ -71,10 +71,10 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db, result->store = db_tdb_store; result->delete_rec = db_tdb_delete; - if (DEBUGLEVEL > 10) { + if (DEBUGLEVEL >= 10) { char *keystr = hex_encode(NULL, key.dptr, key.dsize); DEBUG(10, (DEBUGLEVEL > 10 - ? "Locking key %s\n" : "Locking key %20s\n", + ? "Locking key %s\n" : "Locking key %.20s\n", keystr)); TALLOC_FREE(keystr); }