summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 8deb37f40f9..b85f9a5a901 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfprintf.c,v 1.61 2011/07/06 19:53:52 stsp Exp $ */
+/* $OpenBSD: vfprintf.c,v 1.62 2012/06/26 14:53:23 matthew Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -41,6 +41,7 @@
#include <sys/mman.h>
#include <errno.h>
+#include <langinfo.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
@@ -299,7 +300,7 @@ __vfprintf(FILE *fp, const char *fmt0, __va_list ap)
* D: expchar holds this character; '\0' if no exponent, e.g. %f
* F: at least two digits for decimal, at least one digit for hex
*/
- char *decimal_point = localeconv()->decimal_point;
+ char *decimal_point = NULL;
int signflag; /* true if float is negative */
union { /* floating point arguments %[aAeEfFgG] */
double dbl;
@@ -1014,6 +1015,8 @@ number: if ((dprec = prec) >= 0)
if ((flags & FPT) == 0) {
PRINT(cp, size);
} else { /* glue together f_p fragments */
+ if (decimal_point == NULL)
+ decimal_point = nl_langinfo(RADIXCHAR);
if (!expchar) { /* %[fF] or sufficiently short %[gG] */
if (expt <= 0) {
PRINT(zeroes, 1);