tool_operate: we prefer 'CURLcode result'

This commit is contained in:
Daniel Stenberg
2014-12-16 08:35:47 +01:00
parent b0670ff12b
commit 088b9b2a97
2 changed files with 86 additions and 86 deletions

View File

@@ -202,7 +202,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
CURL *curl = config->easy; CURL *curl = config->easy;
char *httpgetfields = NULL; char *httpgetfields = NULL;
CURLcode res = CURLE_OK; CURLcode result = CURLE_OK;
unsigned long li; unsigned long li;
/* Save the values of noprogress and isatty to restore them later on */ /* Save the values of noprogress and isatty to restore them later on */
@@ -226,7 +226,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* Check we have a url */ /* Check we have a url */
if(!config->url_list || !config->url_list->url) { if(!config->url_list || !config->url_list->url) {
helpf(global->errors, "no URL specified!\n"); helpf(global->errors, "no URL specified!\n");
res = CURLE_FAILED_INIT; result = CURLE_FAILED_INIT;
goto quit_curl; goto quit_curl;
} }
@@ -249,7 +249,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->cacert) { if(!config->cacert) {
curl_free(env); curl_free(env);
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto quit_curl; goto quit_curl;
} }
} }
@@ -260,7 +260,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->capath) { if(!config->capath) {
curl_free(env); curl_free(env);
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto quit_curl; goto quit_curl;
} }
} }
@@ -271,7 +271,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->cacert) { if(!config->cacert) {
curl_free(env); curl_free(env);
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto quit_curl; goto quit_curl;
} }
} }
@@ -282,8 +282,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
curl_free(env); curl_free(env);
#ifdef WIN32 #ifdef WIN32
else { else {
res = FindWin32CACert(config, "curl-ca-bundle.crt"); result = FindWin32CACert(config, "curl-ca-bundle.crt");
if(res) if(result)
goto quit_curl; goto quit_curl;
} }
#endif #endif
@@ -296,19 +296,19 @@ static CURLcode operate_do(struct GlobalConfig *global,
Curl_safefree(config->postfields); Curl_safefree(config->postfields);
if(!httpgetfields) { if(!httpgetfields) {
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto quit_curl; goto quit_curl;
} }
if(SetHTTPrequest(config, if(SetHTTPrequest(config,
(config->no_body?HTTPREQ_HEAD:HTTPREQ_GET), (config->no_body?HTTPREQ_HEAD:HTTPREQ_GET),
&config->httpreq)) { &config->httpreq)) {
res = CURLE_FAILED_INIT; result = CURLE_FAILED_INIT;
goto quit_curl; goto quit_curl;
} }
} }
else { else {
if(SetHTTPrequest(config, HTTPREQ_SIMPLEPOST, &config->httpreq)) { if(SetHTTPrequest(config, HTTPREQ_SIMPLEPOST, &config->httpreq)) {
res = CURLE_FAILED_INIT; result = CURLE_FAILED_INIT;
goto quit_curl; goto quit_curl;
} }
} }
@@ -321,7 +321,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
FILE *newfile = fopen(config->headerfile, "wb"); FILE *newfile = fopen(config->headerfile, "wb");
if(!newfile) { if(!newfile) {
warnf(config, "Failed to open %s\n", config->headerfile); warnf(config, "Failed to open %s\n", config->headerfile);
res = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
goto quit_curl; goto quit_curl;
} }
else { else {
@@ -389,7 +389,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
outfiles = strdup(urlnode->outfile); outfiles = strdup(urlnode->outfile);
if(!outfiles) { if(!outfiles) {
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
break; break;
} }
} }
@@ -398,9 +398,9 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->globoff && infiles) { if(!config->globoff && infiles) {
/* Unless explicitly shut off */ /* Unless explicitly shut off */
res = glob_url(&inglob, infiles, &infilenum, result = glob_url(&inglob, infiles, &infilenum,
global->showerror?global->errors:NULL); global->showerror?global->errors:NULL);
if(res) { if(result) {
Curl_safefree(outfiles); Curl_safefree(outfiles);
break; break;
} }
@@ -423,15 +423,15 @@ static CURLcode operate_do(struct GlobalConfig *global,
Curl_nop_stmt; Curl_nop_stmt;
else { else {
if(inglob) { if(inglob) {
res = (CURLcode) glob_next_url(&uploadfile, inglob); result = glob_next_url(&uploadfile, inglob);
if(res == CURLE_OUT_OF_MEMORY) if(result == CURLE_OUT_OF_MEMORY)
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
} }
else if(!up) { else if(!up) {
uploadfile = strdup(infiles); uploadfile = strdup(infiles);
if(!uploadfile) { if(!uploadfile) {
helpf(global->errors, "out of memory\n"); helpf(global->errors, "out of memory\n");
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
} }
} }
else else
@@ -449,9 +449,9 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->globoff) { if(!config->globoff) {
/* Unless explicitly shut off, we expand '{...}' and '[...]' /* Unless explicitly shut off, we expand '{...}' and '[...]'
expressions and return total number of URLs in pattern set */ expressions and return total number of URLs in pattern set */
res = glob_url(&urls, urlnode->url, &urlnum, result = glob_url(&urls, urlnode->url, &urlnum,
global->showerror?global->errors:NULL); global->showerror?global->errors:NULL);
if(res) { if(result) {
Curl_safefree(uploadfile); Curl_safefree(uploadfile);
break; break;
} }
@@ -493,25 +493,25 @@ static CURLcode operate_do(struct GlobalConfig *global,
filename. */ filename. */
outfile = strdup(mlfile->filename); outfile = strdup(mlfile->filename);
if(!outfile) { if(!outfile) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
this_url = strdup(mlres->url); this_url = strdup(mlres->url);
if(!this_url) { if(!this_url) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
} }
else { else {
if(urls) { if(urls) {
res = (CURLcode) glob_next_url(&this_url, urls); result = glob_next_url(&this_url, urls);
if(res) if(result)
goto show_error; goto show_error;
} }
else if(!li) { else if(!li) {
this_url = strdup(urlnode->url); this_url = strdup(urlnode->url);
if(!this_url) { if(!this_url) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
} }
@@ -523,7 +523,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(outfiles) { if(outfiles) {
outfile = strdup(outfiles); outfile = strdup(outfiles);
if(!outfile) { if(!outfile) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
} }
@@ -540,12 +540,12 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!outfile) { if(!outfile) {
/* extract the file name from the URL */ /* extract the file name from the URL */
res = get_url_file_name(&outfile, this_url); result = get_url_file_name(&outfile, this_url);
if(res) if(result)
goto show_error; goto show_error;
if(!*outfile && !config->content_disposition) { if(!*outfile && !config->content_disposition) {
helpf(global->errors, "Remote file name has no length!\n"); helpf(global->errors, "Remote file name has no length!\n");
res = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
goto quit_urls; goto quit_urls;
} }
#if defined(MSDOS) || defined(WIN32) #if defined(MSDOS) || defined(WIN32)
@@ -553,7 +553,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
bad characters in the file name before using it */ bad characters in the file name before using it */
outfile = sanitize_dos_name(outfile); outfile = sanitize_dos_name(outfile);
if(!outfile) { if(!outfile) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
#endif /* MSDOS || WIN32 */ #endif /* MSDOS || WIN32 */
@@ -561,9 +561,9 @@ static CURLcode operate_do(struct GlobalConfig *global,
else if(urls) { else if(urls) {
/* fill '#1' ... '#9' terms from URL pattern */ /* fill '#1' ... '#9' terms from URL pattern */
char *storefile = outfile; char *storefile = outfile;
res = (CURLcode) glob_match_url(&outfile, storefile, urls); result = glob_match_url(&outfile, storefile, urls);
Curl_safefree(storefile); Curl_safefree(storefile);
if(res) { if(result) {
/* bad globbing */ /* bad globbing */
warnf(config, "bad output glob!\n"); warnf(config, "bad output glob!\n");
goto quit_urls; goto quit_urls;
@@ -574,11 +574,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
file output call */ file output call */
if(config->create_dirs || metalink) { if(config->create_dirs || metalink) {
res = create_dir_hierarchy(outfile, global->errors); result = create_dir_hierarchy(outfile, global->errors);
/* create_dir_hierarchy shows error upon CURLE_WRITE_ERROR */ /* create_dir_hierarchy shows error upon CURLE_WRITE_ERROR */
if(res == CURLE_WRITE_ERROR) if(result == CURLE_WRITE_ERROR)
goto quit_urls; goto quit_urls;
if(res) { if(result) {
goto show_error; goto show_error;
} }
} }
@@ -614,7 +614,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
#endif #endif
if(!file) { if(!file) {
helpf(global->errors, "Can't open '%s'!\n", outfile); helpf(global->errors, "Can't open '%s'!\n", outfile);
res = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
goto quit_urls; goto quit_urls;
} }
outs.fopened = TRUE; outs.fopened = TRUE;
@@ -636,7 +636,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
this_url = add_file_name_to_url(curl, this_url, uploadfile); this_url = add_file_name_to_url(curl, this_url, uploadfile);
if(!this_url) { if(!this_url) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
/* VMS Note: /* VMS Note:
@@ -680,7 +680,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
close(infd); close(infd);
infd = STDIN_FILENO; infd = STDIN_FILENO;
} }
res = CURLE_READ_ERROR; result = CURLE_READ_ERROR;
goto quit_urls; goto quit_urls;
} }
infdopen = TRUE; infdopen = TRUE;
@@ -780,7 +780,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
urlbuffer = aprintf("%s/?%s", this_url, httpgetfields); urlbuffer = aprintf("%s/?%s", this_url, httpgetfields);
if(!urlbuffer) { if(!urlbuffer) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
@@ -1044,21 +1044,21 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!config->insecure_ok) { if(!config->insecure_ok) {
char *home; char *home;
char *file; char *file;
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
home = homedir(); home = homedir();
if(home) { if(home) {
file = aprintf("%s/%sssh/known_hosts", home, DOT_CHAR); file = aprintf("%s/%sssh/known_hosts", home, DOT_CHAR);
if(file) { if(file) {
/* new in curl 7.19.6 */ /* new in curl 7.19.6 */
res = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file); result = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file);
curl_free(file); curl_free(file);
if(res == CURLE_UNKNOWN_OPTION) if(result == CURLE_UNKNOWN_OPTION)
/* libssh2 version older than 1.1.1 */ /* libssh2 version older than 1.1.1 */
res = CURLE_OK; result = CURLE_OK;
} }
Curl_safefree(home); Curl_safefree(home);
} }
if(res) if(result)
goto show_error; goto show_error;
} }
} }
@@ -1155,8 +1155,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* new in curl 7.9.3 */ /* new in curl 7.9.3 */
if(config->engine) { if(config->engine) {
res = res_setopt_str(curl, CURLOPT_SSLENGINE, config->engine); result = res_setopt_str(curl, CURLOPT_SSLENGINE, config->engine);
if(res) if(result)
goto show_error; goto show_error;
my_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L); my_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
} }
@@ -1345,8 +1345,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
retrystart = tvnow(); retrystart = tvnow();
#ifndef CURL_DISABLE_LIBCURL_OPTION #ifndef CURL_DISABLE_LIBCURL_OPTION
res = easysrc_perform(); result = easysrc_perform();
if(res) { if(result) {
goto show_error; goto show_error;
} }
#endif #endif
@@ -1359,7 +1359,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
metalink_parser_context_delete(outs.metalink_parser); metalink_parser_context_delete(outs.metalink_parser);
outs.metalink_parser = metalink_parser_context_new(); outs.metalink_parser = metalink_parser_context_new();
if(outs.metalink_parser == NULL) { if(outs.metalink_parser == NULL) {
res = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
goto show_error; goto show_error;
} }
fprintf(config->global->errors, fprintf(config->global->errors,
@@ -1373,10 +1373,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
#ifdef CURLDEBUG #ifdef CURLDEBUG
if(config->test_event_based) if(config->test_event_based)
res = curl_easy_perform_ev(curl); result = curl_easy_perform_ev(curl);
else else
#endif #endif
res = curl_easy_perform(curl); result = curl_easy_perform(curl);
if(outs.is_cd_filename && outs.stream && !global->mute && if(outs.is_cd_filename && outs.stream && !global->mute &&
outs.filename) outs.filename)
@@ -1396,15 +1396,15 @@ static CURLcode operate_do(struct GlobalConfig *global,
RETRY_LAST /* not used */ RETRY_LAST /* not used */
} retry = RETRY_NO; } retry = RETRY_NO;
long response; long response;
if((CURLE_OPERATION_TIMEDOUT == res) || if((CURLE_OPERATION_TIMEDOUT == result) ||
(CURLE_COULDNT_RESOLVE_HOST == res) || (CURLE_COULDNT_RESOLVE_HOST == result) ||
(CURLE_COULDNT_RESOLVE_PROXY == res) || (CURLE_COULDNT_RESOLVE_PROXY == result) ||
(CURLE_FTP_ACCEPT_TIMEOUT == res)) (CURLE_FTP_ACCEPT_TIMEOUT == result))
/* retry timeout always */ /* retry timeout always */
retry = RETRY_TIMEOUT; retry = RETRY_TIMEOUT;
else if((CURLE_OK == res) || else if((CURLE_OK == result) ||
(config->failonerror && (config->failonerror &&
(CURLE_HTTP_RETURNED_ERROR == res))) { (CURLE_HTTP_RETURNED_ERROR == result))) {
/* If it returned OK. _or_ failonerror was enabled and it /* If it returned OK. _or_ failonerror was enabled and it
returned due to such an error, check for HTTP transient returned due to such an error, check for HTTP transient
errors to retry on. */ errors to retry on. */
@@ -1435,7 +1435,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
} }
} }
} /* if CURLE_OK */ } /* if CURLE_OK */
else if(res) { else if(result) {
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
if(response/100 == 4) if(response/100 == 4)
@@ -1479,7 +1479,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(!global->mute) if(!global->mute)
fprintf(global->errors, fprintf(global->errors,
"failed to truncate, exiting\n"); "failed to truncate, exiting\n");
res = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
goto quit_urls; goto quit_urls;
} }
/* now seek to the end of the file, the position where we /* now seek to the end of the file, the position where we
@@ -1502,7 +1502,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
not. Basically, we want to try the next resource if not. Basically, we want to try the next resource if
download was not successful. */ download was not successful. */
long response; long response;
if(CURLE_OK == res) { if(CURLE_OK == result) {
/* TODO We want to try next resource when download was /* TODO We want to try next resource when download was
not successful. How to know that? */ not successful. How to know that? */
char *effective_url = NULL; char *effective_url = NULL;
@@ -1526,7 +1526,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
"Metalink: fetching (%s) from (%s) FAILED (%s)\n", "Metalink: fetching (%s) from (%s) FAILED (%s)\n",
mlfile->filename, this_url, mlfile->filename, this_url,
(errorbuffer[0]) ? (errorbuffer[0]) ?
errorbuffer : curl_easy_strerror((CURLcode)res)); errorbuffer : curl_easy_strerror(result));
} }
} }
if(metalink && !metalink_next_res) if(metalink && !metalink_next_res)
@@ -1567,10 +1567,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
} }
else else
#endif #endif
if(res && global->showerror) { if(result && global->showerror) {
fprintf(global->errors, "curl: (%d) %s\n", res, (errorbuffer[0]) ? fprintf(global->errors, "curl: (%d) %s\n", result, (errorbuffer[0]) ?
errorbuffer : curl_easy_strerror((CURLcode)res)); errorbuffer : curl_easy_strerror(result));
if(res == CURLE_SSL_CACERT) if(result == CURLE_SSL_CACERT)
fprintf(global->errors, "%s%s", fprintf(global->errors, "%s%s",
CURL_CA_CERT_ERRORMSG1, CURL_CA_CERT_ERRORMSG2); CURL_CA_CERT_ERRORMSG1, CURL_CA_CERT_ERRORMSG2);
} }
@@ -1591,7 +1591,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
quit_urls: quit_urls:
/* Set file extended attributes */ /* Set file extended attributes */
if(!res && config->xattr && outs.fopened && outs.stream) { if(!result && config->xattr && outs.fopened && outs.stream) {
int rc = fwrite_xattr(curl, fileno(outs.stream)); int rc = fwrite_xattr(curl, fileno(outs.stream));
if(rc) if(rc)
warnf(config, "Error setting extended attributes: %s\n", warnf(config, "Error setting extended attributes: %s\n",
@@ -1601,24 +1601,24 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* Close the file */ /* Close the file */
if(outs.fopened && outs.stream) { if(outs.fopened && outs.stream) {
int rc = fclose(outs.stream); int rc = fclose(outs.stream);
if(!res && rc) { if(!result && rc) {
/* something went wrong in the writing process */ /* something went wrong in the writing process */
res = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
fprintf(global->errors, "(%d) Failed writing body\n", res); fprintf(global->errors, "(%d) Failed writing body\n", result);
} }
} }
else if(!outs.s_isreg && outs.stream) { else if(!outs.s_isreg && outs.stream) {
/* Dump standard stream buffered data */ /* Dump standard stream buffered data */
int rc = fflush(outs.stream); int rc = fflush(outs.stream);
if(!res && rc) { if(!result && rc) {
/* something went wrong in the writing process */ /* something went wrong in the writing process */
res = CURLE_WRITE_ERROR; result = CURLE_WRITE_ERROR;
fprintf(global->errors, "(%d) Failed writing body\n", res); fprintf(global->errors, "(%d) Failed writing body\n", result);
} }
} }
#ifdef __AMIGA__ #ifdef __AMIGA__
if(!res && outs.s_isreg && outs.filename) { if(!result && outs.s_isreg && outs.filename) {
/* Set the url (up to 80 chars) as comment for the file */ /* Set the url (up to 80 chars) as comment for the file */
if(strlen(url) > 78) if(strlen(url) > 78)
url[79] = '\0'; url[79] = '\0';
@@ -1628,7 +1628,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
#ifdef HAVE_UTIME #ifdef HAVE_UTIME
/* File time can only be set _after_ the file has been closed */ /* File time can only be set _after_ the file has been closed */
if(!res && config->remote_time && outs.s_isreg && outs.filename) { if(!result && config->remote_time && outs.s_isreg && outs.filename) {
/* Ask libcurl if we got a remote file time */ /* Ask libcurl if we got a remote file time */
long filetime = -1; long filetime = -1;
curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
@@ -1642,7 +1642,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
#endif #endif
#ifdef USE_METALINK #ifdef USE_METALINK
if(!metalink && config->use_metalink && res == CURLE_OK) { if(!metalink && config->use_metalink && result == CURLE_OK) {
int rv = parse_metalink(config, &outs, this_url); int rv = parse_metalink(config, &outs, this_url);
if(rv == 0) if(rv == 0)
fprintf(config->global->errors, "Metalink: parsing (%s) OK\n", fprintf(config->global->errors, "Metalink: parsing (%s) OK\n",
@@ -1651,7 +1651,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
fprintf(config->global->errors, "Metalink: parsing (%s) FAILED\n", fprintf(config->global->errors, "Metalink: parsing (%s) FAILED\n",
this_url); this_url);
} }
else if(metalink && res == CURLE_OK && !metalink_next_res) { else if(metalink && result == CURLE_OK && !metalink_next_res) {
int rv = metalink_check_hash(global, mlfile, outs.filename); int rv = metalink_check_hash(global, mlfile, outs.filename);
if(rv == 0) { if(rv == 0) {
metalink_next_res = 1; metalink_next_res = 1;
@@ -1679,7 +1679,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(metalink) { if(metalink) {
/* Should exit if error is fatal. */ /* Should exit if error is fatal. */
if(is_fatal_error(res)) { if(is_fatal_error(result)) {
break; break;
} }
if(!metalink_next_res) if(!metalink_next_res)
@@ -1694,10 +1694,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
else else
if(urlnum > 1) { if(urlnum > 1) {
/* when url globbing, exit loop upon critical error */ /* when url globbing, exit loop upon critical error */
if(is_fatal_error(res)) if(is_fatal_error(result))
break; break;
} }
else if(res) else if(result)
/* when not url globbing, exit loop upon any error */ /* when not url globbing, exit loop upon any error */
break; break;
@@ -1715,10 +1715,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(infilenum > 1) { if(infilenum > 1) {
/* when file globbing, exit loop upon critical error */ /* when file globbing, exit loop upon critical error */
if(is_fatal_error(res)) if(is_fatal_error(result))
break; break;
} }
else if(res) else if(result)
/* when not file globbing, exit loop upon any error */ /* when not file globbing, exit loop upon any error */
break; break;
@@ -1744,7 +1744,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* /*
** Bail out upon critical errors ** Bail out upon critical errors
*/ */
if(is_fatal_error(res)) if(is_fatal_error(result))
goto quit_curl; goto quit_curl;
} /* for-loop through all URLs */ } /* for-loop through all URLs */
@@ -1777,7 +1777,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* Release metalink related resources here */ /* Release metalink related resources here */
clean_metalink(config); clean_metalink(config);
return res; return result;
} }
CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[]) CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[])

View File

@@ -28,8 +28,8 @@
*/ */
#define SETOPT_CHECK(v) do { \ #define SETOPT_CHECK(v) do { \
res = (v); \ result = (v); \
if(res) \ if(result) \
goto show_error; \ goto show_error; \
} WHILE_FALSE } WHILE_FALSE