summaryrefslogtreecommitdiff
path: root/libquadmath/printf/quadmath-printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libquadmath/printf/quadmath-printf.c')
-rw-r--r--libquadmath/printf/quadmath-printf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libquadmath/printf/quadmath-printf.c b/libquadmath/printf/quadmath-printf.c
index 750dc246fcc..b70f432cce0 100644
--- a/libquadmath/printf/quadmath-printf.c
+++ b/libquadmath/printf/quadmath-printf.c
@@ -256,7 +256,7 @@ quadmath_snprintf (char *str, size_t size, const char *format, ...)
qfp.fp = NULL;
qfp.str = str;
- qfp.size = size;
+ qfp.size = size ? size - 1 : 0;
qfp.len = 0;
qfp.file_p = 0;
@@ -265,7 +265,7 @@ quadmath_snprintf (char *str, size_t size, const char *format, ...)
else
__quadmath_printf_fp (&qfp, &info, (const void *const *)&fpnum_addr2);
- if (qfp.size)
+ if (size)
*qfp.str = '\0';
return qfp.len;