summaryrefslogtreecommitdiff
path: root/lib/ldb/common
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-09-21 13:43:29 +0200
committerAndrew Tridgell <tridge@samba.org>2011-10-11 08:42:07 +0200
commitf2a3125dcb081d8771bbcd09607592fa9cbef028 (patch)
tree934ad3b53dc4a28cee2c110cc38d4d7903856375 /lib/ldb/common
parent0f41868691ebee9c996bb4dcd44a95833349848b (diff)
downloadsamba-f2a3125dcb081d8771bbcd09607592fa9cbef028.tar.gz
samba-f2a3125dcb081d8771bbcd09607592fa9cbef028.tar.bz2
samba-f2a3125dcb081d8771bbcd09607592fa9cbef028.zip
ldb:ldb.c - "ldb_set_errstring" can be implemented by using "ldb_asprintf_errstring"
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'lib/ldb/common')
-rw-r--r--lib/ldb/common/ldb.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index 3adc77ff85..2dd2d1bdde 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -269,28 +269,25 @@ int ldb_connect(struct ldb_context *ldb, const char *url,
void ldb_set_errstring(struct ldb_context *ldb, const char *err_string)
{
- if (ldb->err_string) {
- talloc_free(ldb->err_string);
- }
- ldb->err_string = talloc_strdup(ldb, err_string);
- if (ldb->flags & LDB_FLG_ENABLE_TRACING) {
- ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_set_errstring: %s", ldb->err_string);
- }
+ ldb_asprintf_errstring(ldb, "%s", err_string);
}
void ldb_asprintf_errstring(struct ldb_context *ldb, const char *format, ...)
{
va_list ap;
- char *old_string = NULL;
if (ldb->err_string) {
- old_string = ldb->err_string;
+ talloc_free(ldb->err_string);
}
va_start(ap, format);
ldb->err_string = talloc_vasprintf(ldb, format, ap);
va_end(ap);
- talloc_free(old_string);
+
+ if (ldb->flags & LDB_FLG_ENABLE_TRACING) {
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_asprintf/set_errstring: %s",
+ ldb->err_string);
+ }
}
void ldb_reset_err_string(struct ldb_context *ldb)