summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-06-20 00:54:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:44 -0500
commit8cb41badd4349b7d9d78ff8e25143929522e4749 (patch)
treec4c8f0fb32e7930619c156e4ac81892c607bdc2c /source4
parentbf598954f75bfd924b9aa22649975b372c74a49e (diff)
downloadsamba-8cb41badd4349b7d9d78ff8e25143929522e4749.tar.gz
samba-8cb41badd4349b7d9d78ff8e25143929522e4749.tar.bz2
samba-8cb41badd4349b7d9d78ff8e25143929522e4749.zip
r1199: Make talloc_asprintf_append() work on a NULL source string as if it were
just a alloc_asprintf(). (makes it easier to use in a loop) Andrew Bartlett (This used to be commit 5816d09c47252d2ee8732722b3cc44ea865b8fcc)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/talloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c
index f61ef6d906..9f873a2d6b 100644
--- a/source4/lib/talloc.c
+++ b/source4/lib/talloc.c
@@ -464,7 +464,11 @@ char *talloc_strndup(TALLOC_CTX *t, const char *p, size_t n)
VA_COPY(ap2, ap);
- s_len = strlen(s);
+ if (s) {
+ s_len = strlen(s);
+ } else {
+ s = 0;
+ }
len = vsnprintf(NULL, 0, fmt, ap2);
s = talloc_realloc(t, s, s_len + len+1);