cURL / Mailing Lists / curl-library / Single Mail


Re: Curl 7.21.7 had problem to work.

From: Frank Van Uffelen <>
Date: Mon, 10 Oct 2011 14:32:52 +0200

Hello colleague Fabian,

I narrowed down this problem to singleipconnect in lib/connect.c where
apparently the return value of the connect call gets trashed before it can
be used (this explains the discrepancy between the EINPROGRESS return you
see in strace vs curl's EINVAL diagnostic).

I worked around this problem by applying the following modification

  /* Connect TCP sockets, bind UDP */
  if(!isconnected && (conn->socktype == SOCK_STREAM)) {
    rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
    if (rc != 0) { // if connect didn't succeed save its errno value for
later usage as it can apparently get trashed before usage
    conn->connecttime = Curl_tvnow();
    if(conn->num_addr > 1)
      Curl_expire(data, conn->timeoutms_per_addr);
    rc = 0;

  if(-1 == rc) {
// error = SOCKERRNO; // already saved some lines higher up

    switch (error) {

I have a double question for the mailing list:
1 - although relatively recent (it didn't exist in 7.19.5) this code has
been present in several curl versions, so is the fact that it appears on our
embedded Linux platform a symptom of some deeper issue, or just bad luck?
2 - I don't see any possible side effects, but can you confirm that no ill
side effects could be caused by this patch?

Best regards,


List admin:
Received on 2011-10-10