Work around a scanf() bug in djgpp 2.04. The assignments for this
format is working okay. But the return value is incorrectly EOF.
This commit is contained in:
parent
582833b338
commit
17e1f58fd6
13
lib/url.c
13
lib/url.c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user