diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-10-13 15:17:41 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-10-13 15:17:41 +0200 |
commit | 5ae73c67b5daf493aa2f37027b4567f3633543cf (patch) | |
tree | 299b8acc44012c6ba8869b15fbaa1592abc290a2 /source4 | |
parent | e779345bca36c2dfd11dea773e4b8aa68e4a3863 (diff) | |
download | samba-5ae73c67b5daf493aa2f37027b4567f3633543cf.tar.gz samba-5ae73c67b5daf493aa2f37027b4567f3633543cf.tar.bz2 samba-5ae73c67b5daf493aa2f37027b4567f3633543cf.zip |
Import warning fixes from Samba 3.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/ndr/ndr.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index e19a1eb9ba..e8daa99e15 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -163,16 +163,20 @@ _PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_ return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) +_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) { va_list ap; char *s = NULL; - int i; + int i, ret; va_start(ap, format); - vasprintf(&s, format, ap); + ret = vasprintf(&s, format, ap); va_end(ap); + if (ret == -1) { + return; + } + for (i=0;i<ndr->depth;i++) { DEBUGADD(0,(" ")); } @@ -350,12 +354,17 @@ _PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr, { char *s=NULL; va_list ap; + int ret; va_start(ap, format); - vasprintf(&s, format, ap); + ret = vasprintf(&s, format, ap); va_end(ap); - DEBUG(3,("ndr_pull_error(%u): %s\n", ndr_err, s)); + if (ret == -1) { + return NDR_ERR_ALLOC; + } + + DEBUG(1,("ndr_pull_error(%u): %s\n", ndr_err, s)); free(s); @@ -367,16 +376,21 @@ _PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr, */ _PUBLIC_ enum ndr_err_code ndr_push_error(struct ndr_push *ndr, enum ndr_err_code ndr_err, - const char *format, ...) + const char *format, ...) { char *s=NULL; va_list ap; + int ret; va_start(ap, format); - vasprintf(&s, format, ap); + ret = vasprintf(&s, format, ap); va_end(ap); - DEBUG(3,("ndr_push_error(%u): %s\n", ndr_err, s)); + if (ret == -1) { + return NDR_ERR_ALLOC; + } + + DEBUG(1,("ndr_push_error(%u): %s\n", ndr_err, s)); free(s); |