summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dickman <daniel@cvs.openbsd.org>2014-12-21 00:23:31 +0000
committerDaniel Dickman <daniel@cvs.openbsd.org>2014-12-21 00:23:31 +0000
commit8fd969363d2c6e4c3e6fdb91e0d18d40d07601ce (patch)
treecc67231d82ece12c640d1817afdbd9be47a22884 /lib
parent3301dc44d119d91056738d1287bc44490d906914 (diff)
Show the sign for NaN as per POSIX; from Elliott Hughes.
ok martynas@, millert@, doug@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/vfprintf.c7
-rw-r--r--lib/libc/stdio/vfwprintf.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 7f8ff317794..5f4fb7fa9bb 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfprintf.c,v 1.66 2014/05/03 12:36:45 deraadt Exp $ */
+/* $OpenBSD: vfprintf.c,v 1.67 2014/12/21 00:23:30 daniel Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -753,10 +753,9 @@ fp_common:
if (signflag)
sign = '-';
if (expt == INT_MAX) { /* inf or nan */
- if (*cp == 'N') {
+ if (*cp == 'N')
cp = (ch >= 'a') ? "nan" : "NAN";
- sign = '\0';
- } else
+ else
cp = (ch >= 'a') ? "inf" : "INF";
size = 3;
flags &= ~ZEROPAD;
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
index ef0ca43b91f..a6f41232c53 100644
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfwprintf.c,v 1.11 2014/06/04 07:45:25 stsp Exp $ */
+/* $OpenBSD: vfwprintf.c,v 1.12 2014/12/21 00:23:30 daniel Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -731,10 +731,9 @@ fp_common:
if (signflag)
sign = '-';
if (expt == INT_MAX) { /* inf or nan */
- if (*cp == 'N') {
+ if (*cp == 'N')
cp = (ch >= 'a') ? L"nan" : L"NAN";
- sign = '\0';
- } else
+ else
cp = (ch >= 'a') ? L"inf" : L"INF";
size = 3;
flags &= ~ZEROPAD;