Commit 17e1f58f authored by Gisle Vanem's avatar Gisle Vanem
Browse files

Work around a scanf() bug in djgpp 2.04. The assignments for this

format is working okay. But the return value is incorrectly EOF.
parent 582833b3
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -2978,8 +2978,8 @@ static CURLcode ParseURLAndFillConnection(struct SessionHandle *data,
{
  char *at;
  char *tmp;

  char *path = data->state.path;
  int rc;

  /*************************************************************
   * Parse the URL.
@@ -3052,14 +3052,21 @@ static CURLcode ParseURLAndFillConnection(struct SessionHandle *data,
       * The URL was badly formatted, let's try the browser-style _without_
       * protocol specified like 'http://'.
       */
      if((1 > sscanf(data->change.url, "%[^\n/]%[^\n]",
      if(1 > (rc = sscanf(data->change.url, "%[^\n/]%[^\n]",
                          conn->host.name, path)) ) {
        /*
         * We couldn't even get this format.
         * djgpp 2.04 has a sscanf() bug where 'conn->host.name' is
         * assigned, but the return value is EOF!
         */
#if defined(__DJGPP__) && (DJGPP_MINOR == 4)
        if (!(rc == -1 && *conn->host.name))
#endif
        {
          failf(data, "<url> malformed");
          return CURLE_URL_MALFORMAT;
        }
      }

      /*
       * Since there was no protocol part specified, we guess what protocol it
@@ -3161,7 +3168,7 @@ static CURLcode ParseURLAndFillConnection(struct SessionHandle *data,
   *   conn->host.name is B
   *   data->state.path is /C
   */

  (void)rc;
  return CURLE_OK;
}