aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2010-04-04 23:34:24 +0200
committerKamil Dudka <kdudka@redhat.com>2010-04-04 23:34:24 +0200
commit64ac64e783b5ec969c409c3692f042d6fc4ad9fe (patch)
tree0a36d6e5131a90837c4f8cf9f10f3074c5c653f9
parente7e37a246a2ebd55b8b507e5a3d27744feff6203 (diff)
eliminate a race condition in Curl_resolv_timeout()
-rw-r--r--CHANGES3
-rw-r--r--lib/hostip.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index e8883c471..17a4d5991 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@
Changelog
+Kamil Dudka (4 Apr 2010)
+- Eliminated a race condition in Curl_resolv_timeout().
+
Daniel Stenberg (1 Apr 2010)
- Matt Wixson found and fixed a bug in the SCP/SFTP area where the code
treated a 0 return code from libssh2 to be the same as EAGAIN while in
diff --git a/lib/hostip.c b/lib/hostip.c
index e34fd5a99..9255f6a20 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -628,6 +628,9 @@ int Curl_resolv_timeout(struct connectdata *conn,
clean_up:
if (timeout > 0) {
+ if(!prev_alarm)
+ /* deactivate a possibly active alarm before uninstalling the handler */
+ alarm(0);
#ifdef HAVE_SIGACTION
if(keep_copysig) {
@@ -664,8 +667,6 @@ clean_up:
else
alarm((unsigned int)alarm_set);
}
- else
- alarm(0); /* just shut it off */
}
#endif /* USE_ALARM_TIMEOUT */