Until the new ldb changes land, make ldb_wait set the error string.
authorAndrew Bartlett <abartlet@samba.org>
Wed, 20 Feb 2008 22:53:11 +0000 (09:53 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Feb 2008 22:53:11 +0000 (09:53 +1100)
This makes it easier to track down which module only returned and
error code, but not the error string.

Andrew Bartlett

source/lib/ldb/common/ldb.c

index 87f791cb38795879f9283a03502083476b33e79f..5601a3319126926d829ea710911ffbd728a713c4 100644 (file)
@@ -463,11 +463,17 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, struct ldb_reque
 
 int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type)
 {
+       int ret;
        if (!handle) {
                return LDB_SUCCESS;
        }
 
-       return handle->module->ops->wait(handle, type);
+       ret = handle->module->ops->wait(handle, type);
+       if (!ldb_errstring(handle->module->ldb)) {
+               /* Set a default error string, to place the blame somewhere */
+               ldb_asprintf_errstring(handle->module->ldb, "error waiting on module %s: %s (%d)", handle->module->ops->name, ldb_strerror(ret), ret);
+       }
+       return ret;
 }
 
 /* set the specified timeout or, if timeout is 0 set the default timeout */