cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] libcurl/Curl_resolv_timeout: longjump address should be set before alarm() call

From: Ettore Del Negro <write_at_ettoredelnegro.me>
Date: Thu, 13 Oct 2011 07:08:32 -0400

---
 lib/hostip.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/hostip.c b/lib/hostip.c
index d261a16..ab74d62 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -596,10 +596,6 @@ int Curl_resolv_timeout(struct connectdata *conn,
 #endif
 #endif /* HAVE_SIGACTION */
 
-  /* alarm() makes a signal get sent when the timeout fires off, and that
-     will abort system calls */
-  prev_alarm = alarm(curlx_sltoui(timeout/1000L));
-
   /* This allows us to time-out from the name resolver, as the timeout
      will generate a signal and we will siglongjmp() from that here.
      This technique has problems (see alarmfunc).
@@ -613,6 +609,10 @@ int Curl_resolv_timeout(struct connectdata *conn,
     goto clean_up;
   }
 
+  /* alarm() makes a signal get sent when the timeout fires off, and that
+     will abort system calls */
+  prev_alarm = alarm(curlx_sltoui(timeout/1000L));
+
 #else
 #ifndef CURLRES_ASYNCH
   if(timeoutms)
-- 
1.7.2.5
--------------040004090806010904080906
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
--------------040004090806010904080906--
Received on 2001-09-17