diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-03-13 04:04:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:57:08 -0500 |
commit | 335d07d8114dbb654601ecb8d6d8ea45f94b5b67 (patch) | |
tree | b11264113fc9dd124f22a19545aec9282300564d /source4/lib/talloc | |
parent | 3cad0b87dc55f8eab9b00cd3aa01e817b39a5d62 (diff) | |
download | samba-335d07d8114dbb654601ecb8d6d8ea45f94b5b67.tar.gz samba-335d07d8114dbb654601ecb8d6d8ea45f94b5b67.tar.bz2 samba-335d07d8114dbb654601ecb8d6d8ea45f94b5b67.zip |
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)
Diffstat (limited to 'source4/lib/talloc')
-rw-r--r-- | source4/lib/talloc/talloc.c | 10 |
1 files changed, 8 insertions, 2 deletions
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; } |