summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-11 01:38:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:16 -0500
commit691ba583afaaeb1f6f96befa75396536aed57e97 (patch)
treecc83588e729d5c922d518ac0b7850a42ecce2796 /source4
parentf46690194563521ac978525c593a858b1b8a5947 (diff)
downloadsamba-691ba583afaaeb1f6f96befa75396536aed57e97.tar.gz
samba-691ba583afaaeb1f6f96befa75396536aed57e97.tar.bz2
samba-691ba583afaaeb1f6f96befa75396536aed57e97.zip
r18353: try to fix the assumption of NULL being handled in printf()
permanently by replacing printf() on systems that don't have a C99 printf lib (This used to be commit eacb5357c347255817a0a47abe7dadfaf24301fa)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/replace/snprintf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/lib/replace/snprintf.c b/source4/lib/replace/snprintf.c
index 1ff3c1e324..93285a5e57 100644
--- a/source4/lib/replace/snprintf.c
+++ b/source4/lib/replace/snprintf.c
@@ -1209,6 +1209,27 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
}
#endif
+#ifndef HAVE_C99_VSNPRINTF
+ int printf(const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+ char *s;
+
+ s = NULL;
+ va_start(ap, fmt);
+ ret = vasprintf(&s, fmt, ap);
+ va_end(ap);
+
+ if (s) {
+ fwrite(s, 1, strlen(s), stdout);
+ }
+ free(s);
+
+ return ret;
+}
+#endif
+
#endif
#ifndef HAVE_VASPRINTF