Mercurial > hg > octave-lyh > gnulib-hg
changeset 4801:83746ec4d74a
Portability to HP-UX 10, found by Jim Meyering.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 20 Oct 2003 10:51:59 +0000 |
parents | 372f18516998 |
children | 16d77b789c30 |
files | lib/ChangeLog lib/vasnprintf.c |
diffstat | 2 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2003-10-19 Jim Meyering <jim@meyering.net> + + * vasnprintf.c (vasnprintf): Work around losing snprintf on HPUX 10.20. + 2003-10-16 Paul Eggert <eggert@twinsun.com> * getgroups.c: Include <errno.h>, <stdlib.h>.
--- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -707,7 +707,23 @@ p[1] = '\0'; continue; } - count = retcount; + else + { + /* Look at the snprintf() return value. */ + if (retcount < 0) + { + /* HP-UX 10.20 snprintf() is doubly deficient: + It doesn't understand the '%n' directive, + *and* it returns -1 (rather than the length + that would have been required) when the + buffer is too small. */ + size_t bigger_need = 2 * allocated + 12; + ENSURE_ALLOCATION (bigger_need); + continue; + } + else + count = retcount; + } } #endif