diff options
author | wlemb <wlemb> | 2004-05-09 15:17:47 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2004-05-09 15:17:47 +0000 |
commit | 8d83f9cb216a78d19bbfa9237b80d58d37130101 (patch) | |
tree | 3756c206b563e4da13adc7d080836f97c257f1d0 | |
parent | 33f163652b80bd1ea73e620dcaba8c7393c6c2a7 (diff) | |
download | groff-8d83f9cb216a78d19bbfa9237b80d58d37130101.tar.gz |
* src/preproc/html/pre-html.cpp (make_message): Make it work for
snprintf versions which don't conform to ANSI C 99 (this is,
counting the string's trailing null byte in the return value).
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/preproc/html/pre-html.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2004-05-08 Jan Schaumann <jschauma@netmeister.org> + + * src/preproc/html/pre-html.cpp (make_message): Make it work for + snprintf versions which don't conform to ANSI C 99 (this is, + counting the string's trailing null byte in the return value). + 2004-05-07 Keith Marshall <keith.d.marshall@ntlworld.com> * src/roff/troff/node.cpp (suppress_node::tprint): Don't expect diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp index b0e1ed13..8abcb84c 100644 --- a/src/preproc/html/pre-html.cpp +++ b/src/preproc/html/pre-html.cpp @@ -354,7 +354,7 @@ char *make_message(const char *fmt, ...) n = vsnprintf(p, size, fmt, ap); va_end(ap); /* If that worked, return the string. */ - if (n > -1 && n < size) { + if (n > -1 && n < size - 1) { /* glibc 2.1 and pre-ANSI C 99 */ if (size > n + 1) { np = strsave(p); free(p); @@ -363,8 +363,6 @@ char *make_message(const char *fmt, ...) return p; } /* Else try again with more space. */ - if (n > -1) /* glibc 2.1 */ - size = n + 1; /* precisely what is needed */ else /* glibc 2.0 */ size *= 2; /* twice the old size */ if ((np = (char *)realloc(p, size)) == NULL) { |