From 9dc0b8bd674f71f8ee422b037dc409f2dd4f9487 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Tue, 14 Mar 2006 09:10:20 +0000 Subject: merge Mirek's fetchmail-signed.patch svn path=/branches/BRANCH_6-3/; revision=4734 --- report.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'report.c') diff --git a/report.c b/report.c index 969395be..31d4e482 100644 --- a/report.c +++ b/report.c @@ -241,11 +241,11 @@ report_build (FILE *errfp, message, va_alist) VA_START (args, message); for ( ; ; ) { - n = vsnprintf (partial_message + partial_message_size_used, - partial_message_size - partial_message_size_used, + n = vsnprintf (partial_message + partial_message_size_used, partial_message_size - partial_message_size_used, message, args); - if (n < partial_message_size - partial_message_size_used) + if (n >= 0 + && (unsigned)n < partial_message_size - partial_message_size_used) { partial_message_size_used += n; break; @@ -262,7 +262,8 @@ report_build (FILE *errfp, message, va_alist) partial_message_size - partial_message_size_used, message, a1, a2, a3, a4, a5, a6, a7, a8); - if (n < partial_message_size - partial_message_size_used) + if (n >= 0 + && (unsigned)n < partial_message_size - partial_message_size_used) { partial_message_size_used += n; break; @@ -310,7 +311,9 @@ report_complete (FILE *errfp, message, va_alist) partial_message_size - partial_message_size_used, message, args); - if (n < partial_message_size - partial_message_size_used) + /* old glibc versions return -1 for truncation */ + if (n >= 0 + && (unsigned)n < partial_message_size - partial_message_size_used) { partial_message_size_used += n; break; @@ -327,7 +330,8 @@ report_complete (FILE *errfp, message, va_alist) partial_message_size - partial_message_size_used, message, a1, a2, a3, a4, a5, a6, a7, a8); - if (n < partial_message_size - partial_message_size_used) + if (n >= 0 + && (unsigned)n < partial_message_size - partial_message_size_used) { partial_message_size_used += n; break; -- cgit v1.2.3