From ab4e92ab21887430774fda380ccbb14a10cab2da Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 3 Jan 2005 08:52:39 +0000 Subject: r4502: add an error reporting function (This used to be commit 985a58a16d04f3b92b4bbff86f6c466385f01321) --- source4/lib/ldb/modules/timestamps.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/modules/timestamps.c b/source4/lib/ldb/modules/timestamps.c index 53c39e751e..95a2ddc88e 100644 --- a/source4/lib/ldb/modules/timestamps.c +++ b/source4/lib/ldb/modules/timestamps.c @@ -230,6 +230,14 @@ static int timestamps_unlock(struct ldb_module *module, const char *lockname) static const char *timestamps_errstring(struct ldb_module *module) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_errstring\n"); + if (data->error_string) { + char *error; + + error = data->error_string; + data->error_string = NULL; + return error; + } + return ldb_next_errstring(module); } @@ -256,14 +264,22 @@ struct ldb_module *timestamps_module_init(struct ldb_context *ldb, const char *o #endif { struct ldb_module *ctx; + struct private_data *data; ctx = talloc_p(ldb, struct ldb_module); if (!ctx) return NULL; + data = talloc_p(ctx, struct private_data); + if (!data) { + talloc_free(ctx); + return NULL; + } + + data->error_string = NULL; + ctx->private_data = data; ctx->ldb = ldb; ctx->prev = ctx->next = NULL; - ctx->private_data = NULL; ctx->ops = ×tamps_ops; return ctx; -- cgit