cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] Test 573: Use correct type (double, not long) for CURLINFO_CONNECT_TIME

From: Tor Arntsen <tor_at_spacetec.no>
Date: Thu, 20 May 2010 16:42:09 +0200

curl_easy_getinfo() called with a pointer to long instead of double
would sigbus on RISC processors (e.g. MIPS) due to wrong alignment
of pointer address.

---
This fixes the crash seen in e.g.
http://curl.haxx.se/auto/log.cgi?id=20100520053954-19907#prob12
 tests/libtest/lib573.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/libtest/lib573.c b/tests/libtest/lib573.c
index e08b6df..db5889e 100644
--- a/tests/libtest/lib573.c
+++ b/tests/libtest/lib573.c
@@ -25,7 +25,7 @@ int test(char *URL)
   CURLM *m = NULL;
   int res = 0;
   int running=1;
-  long connect_time = 0;
+  double connect_time = 0.0;
   struct timeval mp_start;
   char mp_timedout = FALSE;
 
@@ -83,8 +83,8 @@ int test(char *URL)
   }
 
   curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time);
-  if (connect_time==0) {
-    fprintf(stderr, "connect time is 0\n");
+  if (connect_time==0.0) {
+    fprintf(stderr, "connect time is 0.0\n");
     res = TEST_ERR_MAJOR_BAD;
   }
 
-- 
1.7.1
Received on 2010-05-20