summaryrefslogtreecommitdiffstats
path: root/bsd-snprintf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-07-01 16:52:55 +1000
committerDamien Miller <djm@mindrot.org>2000-07-01 16:52:55 +1000
commitcb170cb225e62f6deda4911f0fbab2d6cd6b8062 (patch)
tree003880eaf4ddfda40e01a1baee5f2d85f69e2704 /bsd-snprintf.c
parent28adeef966d890b5831d831b1f0e1100c9db5b0a (diff)
- (djm) Added check for broken snprintf() functions which do not correctly
terminate output string and attempt to use replacement.
Diffstat (limited to 'bsd-snprintf.c')
-rw-r--r--bsd-snprintf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bsd-snprintf.c b/bsd-snprintf.c
index c31fc38d..ff26a104 100644
--- a/bsd-snprintf.c
+++ b/bsd-snprintf.c
@@ -26,7 +26,7 @@
#include "config.h"
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
+#if defined(BROKEN_SNPRINTF) || !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <sys/param.h>
#include <sys/types.h>
@@ -120,7 +120,7 @@ mcleanup(str, n, p)
free(curobj);
}
-#if !defined(HAVE_VSNPRINTF)
+#if !defined(HAVE_VSNPRINTF) || defined(BROKEN_SNPRINTF)
int
vsnprintf(str, n, fmt, ap)
char *str;
@@ -152,9 +152,9 @@ vsnprintf(str, n, fmt, ap)
(void) sigaction(SIGSEGV, &osa, NULL);
return (ret);
}
-#endif /* !defined(HAVE_VSNPRINTF) */
+#endif /* !defined(HAVE_VSNPRINTF) || defined(BROKEN_SNPRINTF) */
-#if !defined(HAVE_SNPRINTF)
+#if !defined(HAVE_SNPRINTF) || defined(BROKEN_SNPRINTF)
int
#if __STDC__
snprintf(char *str, size_t n, char const *fmt, ...)
@@ -176,6 +176,6 @@ snprintf(str, n, fmt, va_alist)
return (vsnprintf(str, n, fmt, ap));
va_end(ap);
}
-#endif /* !defined(HAVE_SNPRINTF) */
+#endif /* !defined(HAVE_SNPRINTF) || defined(BROKEN_SNPRINTF) */
-#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
+#endif /* defined(BROKEN_SNPRINTF) || !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */