Author: idra
Date: 2005-01-03 08:52:39 +0000 (Mon, 03 Jan 2005)
New Revision: 4502

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4502

Log:
add an error reporting function
Modified:
   branches/SAMBA_4_0/source/lib/ldb/modules/timestamps.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/modules/timestamps.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/modules/timestamps.c      2005-01-03 
07:57:05 UTC (rev 4501)
+++ branches/SAMBA_4_0/source/lib/ldb/modules/timestamps.c      2005-01-03 
08:52:39 UTC (rev 4502)
@@ -230,6 +230,14 @@
 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 @@
 #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 = &timestamps_ops;
 
        return ctx;

Reply via email to