summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/gcvt.c
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2009-10-16 12:15:04 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2009-10-16 12:15:04 +0000
commit7d672698297cd690f731fb42ff14a0e3ddb35755 (patch)
treefe02a524f7f5098071b58f8a2d7141fb1c30cf65 /lib/libc/stdlib/gcvt.c
parent261fc86bcfe671993b508087f8707ba7f1f1ad27 (diff)
teach gdtoa & its subroutines that malloc can fail; in which case
ecvt, fcvt, gcvt, *printf, strtof, strtod, strtold act per ieee 1003.1. after these massive changes, remove unused files which would not work now. reported by Maksymilian Arciemowicz; ok theo
Diffstat (limited to 'lib/libc/stdlib/gcvt.c')
-rw-r--r--lib/libc/stdlib/gcvt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/gcvt.c b/lib/libc/stdlib/gcvt.c
index c24157e465a..e5488d912dd 100644
--- a/lib/libc/stdlib/gcvt.c
+++ b/lib/libc/stdlib/gcvt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gcvt.c,v 1.10 2006/10/29 18:45:56 deraadt Exp $ */
+/* $OpenBSD: gcvt.c,v 1.11 2009/10/16 12:15:03 martynas Exp $ */
/*
* Copyright (c) 2002, 2003, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -42,6 +42,8 @@ gcvt(double value, int ndigit, char *buf)
}
digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL);
+ if (digits == NULL)
+ return (NULL);
if (decpt == 9999) {
/*
* Infinity or NaN, convert to inf or nan with sign.