]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Prevent nasty problems when platforms lack isinf() and/or isnan().
authorJim Jagielski <jim@apache.org>
Thu, 10 May 2001 14:04:22 +0000 (14:04 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 10 May 2001 14:04:22 +0000 (14:04 +0000)
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@89069 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/Configure
src/ap/ap_snprintf.c

index ab40f99b06c0873740ffbb7633056789e3695bc5..0d4c98f6be6c88c55d719ff7d4156276c552f0c3 100644 (file)
@@ -1,5 +1,8 @@
 Changes with Apache 1.3.20
 
+  *) Autodetect if platforms have isnan() and/or isinf() for use in
+     ap_snprintf.c. [Jim Jagielski]
+
   *) Correct a vulnerability in the Win32 and OS2 ports, by which a 
      client submitting a carefully constructed URI could cause a GP
      (segment) fault in the child process, which would have to be
index b458e41250e01f03c64f2fc77537ca13101fcbf9..ce50b9b25ebaa55b2682396478dd0c0ceb9642ae 100755 (executable)
@@ -2190,6 +2190,41 @@ echo "#endif" >>$AP_CONFIG_AUTO_H
 ####################################################################
 ## More building ap_config_auto.h
 ##
+## Check for availability of isinf() and isnan()
+##
+if ./helpers/TestCompile func isinf ; then
+    echo "" >>$AP_CONFIG_AUTO_H
+    echo "/* determine: isinf() found in libc */ " >>$AP_CONFIG_AUTO_H
+    echo "#ifndef HAVE_ISINF" >>$AP_CONFIG_AUTO_H
+    echo "#define HAVE_ISINF 1" >>$AP_CONFIG_AUTO_H
+    echo "#endif" >>$AP_CONFIG_AUTO_H
+elif ./helpers/TestCompile lib m isinf ; then
+    echo "" >>$AP_CONFIG_AUTO_H
+    echo "/* determine: isinf() found in libm */ " >>$AP_CONFIG_AUTO_H
+    echo "#ifndef HAVE_ISINF" >>$AP_CONFIG_AUTO_H
+    echo "#define HAVE_ISINF 1" >>$AP_CONFIG_AUTO_H
+    echo "#endif" >>$AP_CONFIG_AUTO_H
+    LIBS="$LIBS -lm"
+    ADDED_LM="yes"
+fi
+
+if ./helpers/TestCompile func isnan ; then
+    echo "" >>$AP_CONFIG_AUTO_H
+    echo "/* determine: isnan() found in libc */ " >>$AP_CONFIG_AUTO_H
+    echo "#ifndef HAVE_ISNAN" >>$AP_CONFIG_AUTO_H
+    echo "#define HAVE_ISNAN 1" >>$AP_CONFIG_AUTO_H
+    echo "#endif" >>$AP_CONFIG_AUTO_H
+elif ./helpers/TestCompile lib m isnan ; then
+    echo "" >>$AP_CONFIG_AUTO_H
+    echo "/* determine: isnan() found in libm */ " >>$AP_CONFIG_AUTO_H
+    echo "#ifndef HAVE_ISNAN" >>$AP_CONFIG_AUTO_H
+    echo "#define HAVE_ISNAN 1" >>$AP_CONFIG_AUTO_H
+    echo "#endif" >>$AP_CONFIG_AUTO_H
+    if [ "x$ADDED_LM" != "xyes" ]; then
+        LIBS="$LIBS -lm"
+    fi
+fi
+
 ## We check for the endianess of the machine
 ##
 AP_BYTE_ORDER=`./helpers/TestCompile -r byteorder`
index fdfefd6df01dce3bd76d82ef0249f1ce83033942..882a8135252e623b1816d1216c4c13a6e3e01de3 100644 (file)
@@ -934,15 +934,21 @@ API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *),
                /*
                 * * We use &num_buf[ 1 ], so that we have room for the sign
                 */
+#ifdef HAVE_ISNAN
                if (isnan(fp_num)) {
                    s = "nan";
                    s_len = 3;
                }
-               else if (isinf(fp_num)) {
+               else
+#endif
+#ifdef HAVE_ISINF
+               if (isinf(fp_num)) {
                    s = "inf";
                    s_len = 3;
                }
-               else {
+               else
+#endif
+               {
                    s = conv_fp(*fmt, fp_num, alternate_form,
                            (adjust_precision == NO) ? FLOAT_DIGITS : precision,
                                &is_negative, &num_buf[1], &s_len);