diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-09-21 13:43:29 +0200 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-10-11 08:42:07 +0200 |
commit | f2a3125dcb081d8771bbcd09607592fa9cbef028 (patch) | |
tree | 934ad3b53dc4a28cee2c110cc38d4d7903856375 /lib/ldb/common | |
parent | 0f41868691ebee9c996bb4dcd44a95833349848b (diff) | |
download | samba-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.c | 17 |
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) |