diff options
Diffstat (limited to 'source4/lib/ldb/common/ldb_debug.c')
-rw-r--r-- | source4/lib/ldb/common/ldb_debug.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c index 59f00ccc96..d046c8cd1f 100644 --- a/source4/lib/ldb/common/ldb_debug.c +++ b/source4/lib/ldb/common/ldb_debug.c @@ -86,3 +86,21 @@ void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char * va_end(ap); } + +/* + log a message, and set the ldb error string to the same message +*/ +void ldb_debug_set(struct ldb_context *ldb, enum ldb_debug_level level, + const char *fmt, ...) +{ + va_list ap; + char *msg; + va_start(ap, fmt); + msg = talloc_vasprintf(ldb, fmt, ap); + va_end(ap); + if (msg != NULL) { + ldb_set_errstring(ldb->modules, msg); + ldb_debug(ldb, level, "%s", msg); + } +} + |