summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/gcvt.c
diff options
context:
space:
mode:
authormartynas <>2009-10-16 12:15:03 +0000
committermartynas <>2009-10-16 12:15:03 +0000
commitc60cc3534a1017f18ae4f304bae4d32410563a2b (patch)
tree59d1cec7b9ac419c47f1a14672ac023d3f11f83a /src/lib/libc/stdlib/gcvt.c
parent657f1f4d482640f182b87aff96649878a773d94c (diff)
downloadopenbsd-c60cc3534a1017f18ae4f304bae4d32410563a2b.tar.gz
openbsd-c60cc3534a1017f18ae4f304bae4d32410563a2b.tar.bz2
openbsd-c60cc3534a1017f18ae4f304bae4d32410563a2b.zip
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 'src/lib/libc/stdlib/gcvt.c')
-rw-r--r--src/lib/libc/stdlib/gcvt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/gcvt.c b/src/lib/libc/stdlib/gcvt.c
index c24157e465..e5488d912d 100644
--- a/src/lib/libc/stdlib/gcvt.c
+++ b/src/lib/libc/stdlib/gcvt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gcvt.c,v 1.10 2006/10/29 18:45:56 deraadt Exp $ */ 1/* $OpenBSD: gcvt.c,v 1.11 2009/10/16 12:15:03 martynas Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2002, 2003, 2006 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 2002, 2003, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -42,6 +42,8 @@ gcvt(double value, int ndigit, char *buf)
42 } 42 }
43 43
44 digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL); 44 digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL);
45 if (digits == NULL)
46 return (NULL);
45 if (decpt == 9999) { 47 if (decpt == 9999) {
46 /* 48 /*
47 * Infinity or NaN, convert to inf or nan with sign. 49 * Infinity or NaN, convert to inf or nan with sign.