s4-ldb: added ldb_error() and ldb_operr()
authorAndrew Tridgell <tridge@samba.org>
Tue, 6 Jul 2010 03:20:19 +0000 (13:20 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 7 Jul 2010 10:14:55 +0000 (20:14 +1000)
commitfc68558ab937859a91214e8675d53c0afaf3c4e6
treed24b0d33ffe497012382fb773dea49234e757d2a
parent0b6cebd60288b37f28176e24abeb20109dfd70e5
s4-ldb: added ldb_error() and ldb_operr()

These will be used to help avoid the problem we have with hundreds of
places that do "return LDB_ERR_OPERATIONS_ERROR" without an
explanation. It is very difficult to track down ldb errors which don't
have any explanation.

By replacing "return LDB_ERR_OPERATIONS_ERROR;" with "return ldb_operr(ldb);"
we at least get a file:line message in the ldb error string. It isn't
an ideal error message, but it is much better than just "operations
error"

This change also makes ldb_oom() return the error code
(LDB_ERR_OPERATIONS_ERROR) so you can do:

  return ldb_oom(ldb);

instead of:

  ldb_oom(ldb);
  return LDB_ERR_OPERATIONS_ERROR;
source4/lib/ldb/common/ldb.c
source4/lib/ldb/include/ldb_module.h
source4/lib/ldb/wscript