summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2004-05-09 15:17:47 +0000
committerwlemb <wlemb>2004-05-09 15:17:47 +0000
commit8d83f9cb216a78d19bbfa9237b80d58d37130101 (patch)
tree3756c206b563e4da13adc7d080836f97c257f1d0
parent33f163652b80bd1ea73e620dcaba8c7393c6c2a7 (diff)
downloadgroff-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--ChangeLog6
-rw-r--r--src/preproc/html/pre-html.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index efda9161..919cf44d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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) {