summaryrefslogtreecommitdiff
path: root/lib/ldb/common
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-09-21 12:54:08 +0200
committerAndrew Tridgell <tridge@samba.org>2011-10-11 08:42:07 +0200
commit7599d59d1afd0814c14953a830ba4a618187e95e (patch)
tree851bf40c92b15aab186c2d403b445fbaf1658c5c /lib/ldb/common
parent500d1ba546ff3a677f0a48edc233daeed4d1fe41 (diff)
downloadsamba-7599d59d1afd0814c14953a830ba4a618187e95e.tar.gz
samba-7599d59d1afd0814c14953a830ba4a618187e95e.tar.bz2
samba-7599d59d1afd0814c14953a830ba4a618187e95e.zip
ldb:ldb.c/"ldb_wait" - make "ldb_wait" always return an error string
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'lib/ldb/common')
-rw-r--r--lib/ldb/common/ldb.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index d753bf7bd2..4a0d8043cc 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -578,25 +578,41 @@ int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type)
int ret;
if (!handle) {
- return LDB_ERR_UNAVAILABLE;
+ return ldb_error(handle->ldb, LDB_ERR_UNAVAILABLE, NULL);
}
if (handle->state == LDB_ASYNC_DONE) {
+ if ((handle->status != LDB_SUCCESS) &&
+ (handle->ldb->err_string == NULL)) {
+ /* if no error string was setup by the backend */
+ ldb_asprintf_errstring(handle->ldb, "ldb_wait: %s (%d)",
+ ldb_strerror(handle->status),
+ handle->status);
+ }
return handle->status;
}
ev = ldb_get_event_context(handle->ldb);
if (NULL == ev) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return ldb_oom(handle->ldb);
}
switch (type) {
case LDB_WAIT_NONE:
ret = tevent_loop_once(ev);
if (ret != 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return ldb_operr(handle->ldb);
}
if (handle->status != LDB_SUCCESS) {
+ if (handle->ldb->err_string == NULL) {
+ /*
+ * if no error string was setup by the backend
+ */
+ ldb_asprintf_errstring(handle->ldb,
+ "ldb_wait: %s (%d)",
+ ldb_strerror(handle->status),
+ handle->status);
+ }
return handle->status;
}
break;
@@ -605,13 +621,32 @@ int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type)
while (handle->state != LDB_ASYNC_DONE) {
ret = tevent_loop_once(ev);
if (ret != 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return ldb_operr(handle->ldb);
}
if (handle->status != LDB_SUCCESS) {
+ if (handle->ldb->err_string == NULL) {
+ /*
+ * if no error string was setup by the
+ * backend
+ */
+ ldb_asprintf_errstring(handle->ldb,
+ "ldb_wait: %s (%d)",
+ ldb_strerror(handle->status),
+ handle->status);
+ }
return handle->status;
}
}
if (handle->status != LDB_SUCCESS) {
+ if (handle->ldb->err_string == NULL) {
+ /*
+ * if no error string was setup by the backend
+ */
+ ldb_asprintf_errstring(handle->ldb,
+ "ldb_wait: %s (%d)",
+ ldb_strerror(handle->status),
+ handle->status);
+ }
return handle->status;
}
break;