Mercurial > hg > octave-kai > gnulib-hg
changeset 13806:3468ff86245b
vasnprintf: Don't set errno to 0.
* lib/vasnprintf.c (VASNPRINTF): Save and restore errno around the
block that sets it to 0.
Reported by Gianluigi Tiesi <sherpya@netfarm.it>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 15 Oct 2010 02:01:51 +0200 |
parents | f72343ef3cf6 |
children | 829f93de17ed |
files | ChangeLog lib/vasnprintf.c |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-10-14 Bruno Haible <bruno@clisp.org> + + vasnprintf: Don't set errno to 0. + * lib/vasnprintf.c (VASNPRINTF): Save and restore errno around the + block that sets it to 0. + Reported by Gianluigi Tiesi <sherpya@netfarm.it>. + 2010-10-14 Bruno Haible <bruno@clisp.org> socketlib: Fix.
--- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -4599,6 +4599,7 @@ TCHAR_T *fbp; unsigned int prefix_count; int prefixes[2] IF_LINT (= { 0 }); + int orig_errno; #if !USE_SNPRINTF size_t tmp_length; TCHAR_T tmpbuf[700]; @@ -4902,6 +4903,8 @@ *(TCHAR_T *) (result + length) = '\0'; #endif + orig_errno = errno; + for (;;) { int count = -1; @@ -5499,6 +5502,7 @@ length += count; break; } + errno = orig_errno; #undef pad_ourselves #undef prec_ourselves }