summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/gcvt.c
diff options
context:
space:
mode:
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.