From 335d07d8114dbb654601ecb8d6d8ea45f94b5b67 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Mar 2006 04:04:38 +0000 Subject: r14288: - make the snprintf call in talloc portable to older solaris boxes - fixed an error found sing the beam analyser (This used to be commit bc45451ddd6eceb9bf1ca02f84932759d99a1744) --- source4/lib/talloc/talloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 5bb21ee6e6..99ede462b8 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -293,7 +293,11 @@ static int talloc_unreference(const void *context, const void *ptr) for (h=tc->refs;h;h=h->next) { struct talloc_chunk *p = talloc_parent_chunk(h); - if ((p==NULL && context==NULL) || TC_PTR_FROM_CHUNK(p) == context) break; + if (p == NULL) { + if (context == NULL) break; + } else if (TC_PTR_FROM_CHUNK(p) == context) { + break; + } } if (h == NULL) { return -1; @@ -1010,10 +1014,12 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) int len; char *ret; va_list ap2; + char c; VA_COPY(ap2, ap); - if ((len = vsnprintf(NULL, 0, fmt, ap2)) < 0) { + /* this call looks strange, but it makes it work on older solaris boxes */ + if ((len = vsnprintf(&c, 1, fmt, ap2)) < 0) { return NULL; } -- cgit