summaryrefslogtreecommitdiff
path: root/source3/lib/dprintf.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-03-30 13:08:31 -0700
committerJeremy Allison <jra@samba.org>2011-03-30 23:59:37 +0200
commitc109a70531de72eef30a695248b91704bd0c7c24 (patch)
tree29182afa1ae334e8aee0e71e59aa1a0e5de65f6a /source3/lib/dprintf.c
parent9ede19fdccaf09303012208129a093197403ef2c (diff)
downloadsamba-c109a70531de72eef30a695248b91704bd0c7c24.tar.gz
samba-c109a70531de72eef30a695248b91704bd0c7c24.tar.bz2
samba-c109a70531de72eef30a695248b91704bd0c7c24.zip
Fix convert_string() to take a *converted_size arg. and return a bool.
Makes these interfaces much harder to misuse and easier to ensure error checking. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 23:59:37 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/lib/dprintf.c')
-rw-r--r--source3/lib/dprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/lib/dprintf.c b/source3/lib/dprintf.c
index 97129f8b4a..ad3c79a8d5 100644
--- a/source3/lib/dprintf.c
+++ b/source3/lib/dprintf.c
@@ -35,6 +35,7 @@
{
char *p = NULL, *p2 = NULL;
int ret, maxlen, clen;
+ size_t size = 0;
const char *msgstr;
va_list ap2;
@@ -66,11 +67,11 @@ again:
goto out;
}
- clen = convert_string(CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen);
- if (clen == -1) {
+ if (!convert_string(CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen, &size)) {
ret = -1;
goto out;
}
+ clen = size;
if (clen >= maxlen) {
/* it didn't fit - try a larger buffer */