summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:13:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:13:13 +0930
commit376511ed4defeeeabcfaa83acd230afd4a46b6fd (patch)
tree645c7363da2368089f947d872f14f98bb6752a00 /lib
parentab61a57e0177ff50a22a8feea38abbf02edfd5da (diff)
downloadsamba-376511ed4defeeeabcfaa83acd230afd4a46b6fd.tar.gz
samba-376511ed4defeeeabcfaa83acd230afd4a46b6fd.tar.bz2
samba-376511ed4defeeeabcfaa83acd230afd4a46b6fd.zip
tdb_compat: adapt to tdb2 API change.
Add the ecode arg to all the log functions, and log it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/ldb_tdb/ldb_tdb_wrap.c4
-rw-r--r--lib/tdb2/pytdb.c4
-rw-r--r--lib/tdb_compat/tdb_compat.c1
-rw-r--r--lib/tdb_compat/tdb_compat.h2
-rw-r--r--lib/util/tdb_wrap.c4
5 files changed, 12 insertions, 3 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 16a037a6c3..3ddcba5cea 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -28,6 +28,7 @@
#if BUILD_TDB2
static void ltdb_log_fn(struct tdb_context *tdb,
enum tdb_log_level level,
+ enum TDB_ERROR ecode,
const char *message,
struct ldb_context *ldb)
{
@@ -45,7 +46,8 @@ static void ltdb_log_fn(struct tdb_context *tdb,
ldb_level = LDB_DEBUG_FATAL;
}
- ldb_debug(ldb, ldb_level, "ltdb: tdb(%s): %s", name, message);
+ ldb_debug(ldb, ldb_level, "ltdb: tdb(%s): %s: %s", name,
+ tdb_errorstr(ecode), message);
}
#else /* !TDB2 */
static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
diff --git a/lib/tdb2/pytdb.c b/lib/tdb2/pytdb.c
index c760045508..c03f00d58c 100644
--- a/lib/tdb2/pytdb.c
+++ b/lib/tdb2/pytdb.c
@@ -74,10 +74,12 @@ static PyObject *PyString_FromTDB_DATA(TDB_DATA data)
static void stderr_log(struct tdb_context *tdb,
enum tdb_log_level level,
+ enum TDB_ERROR ecode,
const char *message,
void *data)
{
- fprintf(stderr, "%s:%s\n", tdb_name(tdb), message);
+ fprintf(stderr, "%s:%s:%s\n",
+ tdb_name(tdb), tdb_errorstr(ecode), message);
}
static PyObject *py_tdb_open(PyTypeObject *type, PyObject *args, PyObject *kwargs)
diff --git a/lib/tdb_compat/tdb_compat.c b/lib/tdb_compat/tdb_compat.c
index a9173fc33d..d736db1742 100644
--- a/lib/tdb_compat/tdb_compat.c
+++ b/lib/tdb_compat/tdb_compat.c
@@ -69,6 +69,7 @@ tdb_open_compat_(const char *name, int hash_size_unused,
int tdb_flags, int open_flags, mode_t mode,
void (*log_fn)(struct tdb_context *,
enum tdb_log_level,
+ enum TDB_ERROR,
const char *message,
void *data),
void *log_data)
diff --git a/lib/tdb_compat/tdb_compat.h b/lib/tdb_compat/tdb_compat.h
index ea401cba49..80fc3cef80 100644
--- a/lib/tdb_compat/tdb_compat.h
+++ b/lib/tdb_compat/tdb_compat.h
@@ -90,6 +90,7 @@ enum TDB_ERROR tdb_transaction_start_nonblock(struct tdb_context *tdb);
(log_fn), (log_data), \
struct tdb_context *, \
enum tdb_log_level, \
+ enum TDB_ERROR, \
const char *), \
(log_data))
@@ -98,6 +99,7 @@ tdb_open_compat_(const char *name, int hash_size_unused,
int tdb_flags, int open_flags, mode_t mode,
void (*log_fn)(struct tdb_context *,
enum tdb_log_level,
+ enum TDB_ERROR ecode,
const char *message,
void *data),
void *log_data);
diff --git a/lib/util/tdb_wrap.c b/lib/util/tdb_wrap.c
index 71aea5e36c..a3dc76d6b7 100644
--- a/lib/util/tdb_wrap.c
+++ b/lib/util/tdb_wrap.c
@@ -27,6 +27,7 @@
#if BUILD_TDB2
static void tdb_wrap_log(struct tdb_context *tdb,
enum tdb_log_level level,
+ enum TDB_ERROR ecode,
const char *message,
void *unused)
{
@@ -45,7 +46,8 @@ static void tdb_wrap_log(struct tdb_context *tdb,
dl = 0;
}
- DEBUG(dl, ("tdb(%s): %s", name ? name : "unnamed", message));
+ DEBUG(dl, ("tdb(%s):%s: %s", name ? name : "unnamed",
+ tdb_errorstr(ecode), message));
}
#else
/*