summaryrefslogtreecommitdiff
path: root/lib/tdb2/test/tdb1-logging.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:32:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:32:13 +0930
commite613effeae7c9373c9e635fc708ec2ce29661d4c (patch)
treed8cdb019f54302de6aa813a62a34e036cf9c7faf /lib/tdb2/test/tdb1-logging.c
parent50484d4bede6b59706457e44a32cbe2d3e9c28d2 (diff)
downloadsamba-e613effeae7c9373c9e635fc708ec2ce29661d4c.tar.gz
samba-e613effeae7c9373c9e635fc708ec2ce29661d4c.tar.bz2
samba-e613effeae7c9373c9e635fc708ec2ce29661d4c.zip
tdb2: make TDB1 code use tdb2's TDB_ERROR and tdb_logerr()
To do this, we make sure that the first few fields of tdb1_context and tdb_context are the same. This sweep also fixes up a few paths where we weren't setting tdb->ecode before our old logging function. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 919937354a331bb964564a11b5a5b80403ff8db9)
Diffstat (limited to 'lib/tdb2/test/tdb1-logging.c')
-rw-r--r--lib/tdb2/test/tdb1-logging.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/tdb2/test/tdb1-logging.c b/lib/tdb2/test/tdb1-logging.c
index 43ce07b27c..3424296b91 100644
--- a/lib/tdb2/test/tdb1-logging.c
+++ b/lib/tdb2/test/tdb1-logging.c
@@ -7,24 +7,19 @@
/* Turn log messages into tap diag messages. */
static void taplog(struct tdb1_context *tdb,
- enum tdb1_debug_level level,
- const char *fmt, ...)
+ enum tdb_log_level level,
+ enum TDB_ERROR ecode,
+ const char *message,
+ void *data)
{
- va_list ap;
- char line[200];
-
if (suppress_logging)
return;
- va_start(ap, fmt);
- vsprintf(line, fmt, ap);
- va_end(ap);
-
/* Strip trailing \n: diag adds it. */
- if (line[0] && line[strlen(line)-1] == '\n')
- diag("%s%.*s", log_prefix, (unsigned)strlen(line)-1, line);
+ if (message[0] && message[strlen(message)-1] == '\n')
+ diag("%s%.*s", log_prefix, (unsigned)strlen(message)-1, message);
else
- diag("%s%s", log_prefix, line);
+ diag("%s%s", log_prefix, message);
}
struct tdb1_logging_context taplogctx = { taplog, NULL };