From fd7fcdf9dfc2a6c6129a20eef28a600134467261 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 23 Mar 2010 15:01:53 +0000 Subject: [PATCH] - remove signal handler in case of DNS timeout (upstream commit 6657f12) --- curl-7.19.7-dns-timeout.patch | 49 +++++++++++++++++++++++++++++++++++ curl.spec | 7 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 curl-7.19.7-dns-timeout.patch diff --git a/curl-7.19.7-dns-timeout.patch b/curl-7.19.7-dns-timeout.patch new file mode 100644 index 0000000..5741ac7 --- /dev/null +++ b/curl-7.19.7-dns-timeout.patch @@ -0,0 +1,49 @@ +diff --git a/lib/hostip.c b/lib/hostip.c +index 113c6d2..94f7b4c 100644 +--- a/lib/hostip.c ++++ b/lib/hostip.c +@@ -579,15 +579,6 @@ int Curl_resolv_timeout(struct connectdata *conn, + return CURLRESOLV_TIMEDOUT; + + if (timeout > 0) { +- /* 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). */ +- if(sigsetjmp(curl_jmpenv, 1)) { +- /* this is coming from a siglongjmp() after an alarm signal */ +- failf(data, "name lookup timed out"); +- return CURLRESOLV_ERROR; +- } +- + /************************************************************* + * Set signal handler to catch SIGALRM + * Store the old value to be able to set it back later! +@@ -613,6 +604,19 @@ int Curl_resolv_timeout(struct connectdata *conn, + /* alarm() makes a signal get sent when the timeout fires off, and that + will abort system calls */ + prev_alarm = alarm((unsigned int) (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). ++ This should be the last thing we do before calling Curl_resolv(), ++ as otherwise we'd have to worry about variables that get modified ++ before we invoke Curl_resolv() (and thus use "volatile"). */ ++ if(sigsetjmp(curl_jmpenv, 1)) { ++ /* this is coming from a siglongjmp() after an alarm signal */ ++ failf(data, "name lookup timed out"); ++ rc = CURLRESOLV_ERROR; ++ goto clean_up; ++ } + } + + #else +@@ -629,6 +633,8 @@ int Curl_resolv_timeout(struct connectdata *conn, + */ + rc = Curl_resolv(conn, hostname, port, entry); + ++clean_up: ++ + #ifdef USE_ALARM_TIMEOUT + if (timeout > 0) { + diff --git a/curl.spec b/curl.spec index af78f42..9733081 100644 --- a/curl.spec +++ b/curl.spec @@ -1,13 +1,14 @@ Summary: A utility for getting files from remote servers (FTP, HTTP, and others) Name: curl Version: 7.19.7 -Release: 5%{?dist} +Release: 6%{?dist} License: MIT Group: Applications/Internet Source: http://curl.haxx.se/download/%{name}-%{version}.tar.bz2 Patch1: curl-7.19.7-modelfree.patch Patch2: curl-7.19.7-ssl-retry.patch Patch3: curl-7.19.7-ssl-timeout.patch +Patch4: curl-7.19.7-dns-timeout.patch Patch101: curl-7.15.3-multilib.patch Patch102: curl-7.16.0-privlibs.patch Patch103: curl-7.19.4-debug.patch @@ -55,6 +56,7 @@ use cURL's capabilities internally. # upstream patches (already applied) %patch1 -p1 %patch2 -p1 +%patch4 -p1 # other patches %patch3 -p1 @@ -159,6 +161,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/aclocal/libcurl.m4 %changelog +* Tue Mar 23 2010 Kamil Dudka - 7.19.7-6 +- remove signal handler in case of DNS timeout (upstream commit 6657f12) + * Mon Feb 22 2010 Kamil Dudka 7.19.7-5 - http://curl.haxx.se/docs/adv_20100209.html (#563240)