ports/110270: backport patch for ftp/curl from CURL's CVS

Eygene Ryabinkin rea-fbsd at codelabs.ru
Wed Mar 14 14:13:10 UTC 2007


As was found yesterday and reported to Peter, I've found one more
SEGV in the curl code that was fixed in the CVS release -- git's
HTTP push utility provoked the SEGV. Tracked the problem to the
specific commit to the CVS and backported the patch for the 7.16.1.
See http://cool.haxx.se/cvs.cgi/curl/lib/url.c.diff?r2=1.585&r1=1.584&diff_format=u

The new patch (not a patch to a patch, but a complete patchfile) for
lib/url.c is below.

Peter, I will appreciate the information about
'data->set.no_signal = TRUE'.

--- lib/url.c.orig	Wed Mar 14 16:48:31 2007
+++ lib/url.c	Wed Mar 14 16:48:22 2007
@@ -553,6 +553,10 @@
     data->set.httpauth = CURLAUTH_BASIC;  /* defaults to basic */
     data->set.proxyauth = CURLAUTH_BASIC; /* defaults to basic */
 
+#if defined(__FreeBSD_version)
+    data->set.no_signal = TRUE; /* different handling of signals and threads */
+#endif /* __FreeBSD_version */
+
     /* This no longer creates a connection cache here. It is instead made on
        the first call to curl_easy_perform() or when the handle is added to a
        multi stack. */
@@ -1993,7 +1997,8 @@
                                   from the multi */
     }
 
-    infof(data, "Examining connection #%ld for reuse\n", check->connectindex);
+    DEBUGF(infof(data, "Examining connection #%ld for reuse\n",
+                 check->connectindex));
 
     if(check->inuse && !canPipeline) {
       /* can only happen within multi handles, and means that another easy
@@ -2019,11 +2024,11 @@
       continue;
     }
 
-    if (data->state.is_in_pipeline && check->bits.close) {
-        /* Don't pick a connection that is going to be closed */
-        infof(data, "Connection #%ld has been marked for close, can't reuse\n",
-              check->connectindex);
-        continue;
+    if (check->bits.close) {
+      /* Don't pick a connection that is going to be closed. */
+      infof(data, "Connection #%ld has been marked for close, can't reuse\n",
+            check->connectindex);
+      continue;
     }
 
     if((needle->protocol&PROT_SSL) != (check->protocol&PROT_SSL))
@@ -4092,8 +4097,9 @@
 
 
 CURLcode Curl_done(struct connectdata **connp,
-                   CURLcode status, bool premature) /* an error if this is called after an
-                                       error was detected */
+                   CURLcode status,  /* an error if this is called after an
+                                        error was detected */
+                   bool premature)
 {
   CURLcode result;
   struct connectdata *conn = *connp;
@@ -4151,9 +4157,6 @@
   if(data->set.reuse_forbid || conn->bits.close) {
     CURLcode res2 = Curl_disconnect(conn); /* close the connection */
 
-    *connp = NULL; /* to make the caller of this function better detect that
-                      this was actually killed here */
-
     /* If we had an error already, make sure we return that one. But
        if we got a new error, return that. */
     if(!result && res2)
@@ -4169,6 +4172,9 @@
           conn->connectindex,
           conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
   }
+
+  *connp = NULL; /* to make the caller of this function better detect that
+                    this was actually killed here */
 
   return result;
 }



More information about the freebsd-ports-bugs mailing list