From bb23f5725f538d14b2ccec0463cfb1136be3ebd0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 31 Dec 2008 16:30:11 -0800 Subject: Fix more asprintf and "ignoring return code" warnings from gcc 4.3. Jeremy. --- source3/script/mkbuildoptions.awk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source3/script') diff --git a/source3/script/mkbuildoptions.awk b/source3/script/mkbuildoptions.awk index 02562cf7b2..a1e5d85061 100644 --- a/source3/script/mkbuildoptions.awk +++ b/source3/script/mkbuildoptions.awk @@ -23,29 +23,31 @@ BEGIN { print "#include \"build_env.h\""; print "#include \"dynconfig.h\""; print ""; - print "static void output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);"; + print "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);"; print "void build_options(bool screen);"; print ""; print ""; print "/****************************************************************************"; print "helper function for build_options"; print "****************************************************************************/"; - print "static void output(bool screen, const char *format, ...)"; + print "static int output(bool screen, const char *format, ...)"; print "{"; - print " char *ptr;"; + print " char *ptr = NULL;"; + print " int ret = 0;"; print " va_list ap;"; print " "; print " va_start(ap, format);"; - print " vasprintf(&ptr,format,ap);"; + print " ret = vasprintf(&ptr,format,ap);"; print " va_end(ap);"; print ""; print " if (screen) {"; - print " d_printf(\"%s\", ptr);"; + print " d_printf(\"%s\", ptr ? ptr : \"\");"; print " } else {"; - print " DEBUG(4,(\"%s\", ptr));"; + print " DEBUG(4,(\"%s\", ptr ? ptr : \"\"));"; print " }"; print " "; print " SAFE_FREE(ptr);"; + print " return ret;"; print "}"; print ""; print "/****************************************************************************"; -- cgit