Fix nan output in the printf family.

Bug: https://code.google.com/p/android/issues/detail?id=82452
Change-Id: I51f226c8b033de6e81baeea5e6db3de6ed196f73
This commit is contained in:
Elliott Hughes
2014-12-16 14:45:32 -08:00
parent 92b9cb2c89
commit 1b18aff9ba
3 changed files with 62 additions and 20 deletions

View File

@@ -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;

View File

@@ -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;