diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2018-02-08 13:07:16 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2018-02-08 13:07:16 +0100 |
commit | e0abf14b09f5fcb20fa2301a9a0499d3d1c5d11a (patch) | |
tree | de0393324ee06e6aee14a8e2c0243cc6f4536483 /printf | |
parent | 95d89505a623cd743e05ac8b0b30ddcb85091506 (diff) | |
download | gmp-e0abf14b09f5fcb20fa2301a9a0499d3d1c5d11a.tar.gz |
printf/snprntffuns.c: report -1 as an error.
acinclude.m4: Refuse -1 as a normal return value.
Diffstat (limited to 'printf')
-rw-r--r-- | printf/snprntffuns.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/printf/snprntffuns.c b/printf/snprntffuns.c index d5d76a29f..562227908 100644 --- a/printf/snprntffuns.c +++ b/printf/snprntffuns.c @@ -75,10 +75,7 @@ gmp_snprintf_format (struct gmp_snprintf_t *d, const char *fmt, va_copy (ap, orig_ap); ret = vsnprintf (d->buf, avail, fmt, ap); if (ret == -1) - { - ASSERT (strlen (d->buf) == avail-1); - ret = avail-1; - } + return ret; step = MIN (ret, avail-1); d->size -= step; @@ -104,7 +101,7 @@ gmp_snprintf_format (struct gmp_snprintf_t *d, const char *fmt, ret = vsnprintf (p, alloc, fmt, ap); __GMP_FREE_FUNC_TYPE (p, alloc, char); } - while (ret == alloc-1 || ret == -1); + while (ret == alloc-1); return ret; } |