summaryrefslogtreecommitdiff
path: root/strings/my_vsnprintf.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-06-28 01:53:41 +0300
committerMichael Widenius <monty@askmonty.org>2013-06-28 01:53:41 +0300
commitecf9b1b754a2d67137f0b16661309d021560ad2d (patch)
treed6da9cce825a146ef8432d38fb9dc0d5b81b9a2a /strings/my_vsnprintf.c
parent70092601bc3fa0fbae06b12c1e77b81d05bc3224 (diff)
downloadmariadb-git-ecf9b1b754a2d67137f0b16661309d021560ad2d.tar.gz
Fixed some wrong format strings.
Fixed OPTIMIZE with innodb include/my_sys.h: Removed ATTRIBUTE_FORMAT() as it gave warnings for %'s sql/log_event.cc: Optimization: use my_b_write() and my_b_write_byte() instead of my_b_printf() use strmake() instead of my_snprintf() sql/sql_admin.cc: Fixed bug in admin_recreate_table() Fixed OPTIMIZE with innodb sql/sql_table.cc: Indentation fixes strings/my_vsnprintf.c: Changed fprintf() to fputs()
Diffstat (limited to 'strings/my_vsnprintf.c')
-rw-r--r--strings/my_vsnprintf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index a05f60decf9..1584a9e2cef 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -735,7 +735,7 @@ int my_vfprintf(FILE *stream, const char* format, va_list args)
char cvtbuf[1024];
int alloc= 0;
char *p= cvtbuf;
- size_t cur_len= sizeof(cvtbuf);
+ size_t cur_len= sizeof(cvtbuf), actual;
int ret;
/*
@@ -746,7 +746,7 @@ int my_vfprintf(FILE *stream, const char* format, va_list args)
for (;;)
{
size_t new_len;
- size_t actual= my_vsnprintf(p, cur_len, format, args);
+ actual= my_vsnprintf(p, cur_len, format, args);
if (actual < cur_len - 1)
break;
/*
@@ -766,7 +766,9 @@ int my_vfprintf(FILE *stream, const char* format, va_list args)
if (!p)
return 0;
}
- ret= fprintf(stream, "%s", p);
+ ret= (int) actual;
+ if (fputs(p, stream) < 0)
+ ret= -1;
if (alloc)
(*my_str_free)(p);
return ret;