1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Improve code readbility

... by removing the else branch after a return, break or continue.

Closes #1310
This commit is contained in:
Sylvestre Ledru 2017-03-10 14:28:37 +01:00 committed by Daniel Stenberg
parent db87bcfcf2
commit 66de563482
37 changed files with 405 additions and 496 deletions

View File

@ -810,7 +810,6 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return CURLE_OK; return CURLE_OK;
} }
else
infof(data, "Connection failed\n"); infof(data, "Connection failed\n");
} }
else if(rc & CURL_CSELECT_ERR) else if(rc & CURL_CSELECT_ERR)

View File

@ -130,7 +130,6 @@ inflate_stream(struct connectdata *conn,
free(decomp); free(decomp);
if(inflateEnd(z) == Z_OK) if(inflateEnd(z) == Z_OK)
return exit_zlib(z, &k->zlib_init, result); return exit_zlib(z, &k->zlib_init, result);
else
return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z)); return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
} }

View File

@ -929,7 +929,6 @@ static char *get_line(char *buf, int len, FILE *input)
} }
return b; return b;
} }
else
/* read a partial, discard the next piece that ends with newline */ /* read a partial, discard the next piece that ends with newline */
partial = TRUE; partial = TRUE;
} }

View File

@ -469,7 +469,7 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
/* This is a dotted IP address 123.123.123.123-style */ /* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, address, port); return Curl_ip2addr(AF_INET, &in, address, port);
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
else { {
struct in6_addr in6; struct in6_addr in6;
if(Curl_inet_pton(AF_INET6, address, &in6) > 0) if(Curl_inet_pton(AF_INET6, address, &in6) > 0)
/* This is a dotted IPv6 address ::1-style */ /* This is a dotted IPv6 address ::1-style */

View File

@ -145,7 +145,6 @@ static int setcharset(unsigned char **p, unsigned char *charset)
else if(c == ']') { else if(c == ']') {
if(something_found) if(something_found)
return SETCHARSET_OK; return SETCHARSET_OK;
else
something_found = TRUE; something_found = TRUE;
state = CURLFNM_SCHS_RIGHTBR; state = CURLFNM_SCHS_RIGHTBR;
charset[c] = 1; charset[c] = 1;
@ -244,7 +243,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
if(c == ']') { if(c == ']') {
return SETCHARSET_OK; return SETCHARSET_OK;
} }
else if(c == '\\') { if(c == '\\') {
c = *(++(*p)); c = *(++(*p));
if(ISPRINT(c)) { if(ISPRINT(c)) {
charset[c] = 1; charset[c] = 1;
@ -345,7 +344,6 @@ static int loop(const unsigned char *pattern, const unsigned char *string)
else if(*p == '\0') { else if(*p == '\0') {
if(*s == '\0') if(*s == '\0')
return CURL_FNMATCH_MATCH; return CURL_FNMATCH_MATCH;
else
return CURL_FNMATCH_NOMATCH; return CURL_FNMATCH_NOMATCH;
} }
else if(*p == '\\') { else if(*p == '\\') {

View File

@ -773,7 +773,6 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
curl_multi_cleanup(multi); curl_multi_cleanup(multi);
if(mcode == CURLM_OUT_OF_MEMORY) if(mcode == CURLM_OUT_OF_MEMORY)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
else
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }

View File

@ -113,10 +113,8 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
testing_ptr = Curl_saferealloc(ns, alloc); testing_ptr = Curl_saferealloc(ns, alloc);
if(!testing_ptr) if(!testing_ptr)
return NULL; return NULL;
else {
ns = testing_ptr; ns = testing_ptr;
} }
}
result = Curl_convert_to_network(data, &in, 1); result = Curl_convert_to_network(data, &in, 1);
if(result) { if(result) {

View File

@ -355,7 +355,6 @@ static CURLcode file_upload(struct connectdata *conn)
failf(data, "Can't get the size of %s", file->path); failf(data, "Can't get the size of %s", file->path);
return CURLE_WRITE_ERROR; return CURLE_WRITE_ERROR;
} }
else
data->state.resume_from = (curl_off_t)file_stat.st_size; data->state.resume_from = (curl_off_t)file_stat.st_size;
} }
@ -519,7 +518,6 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
failf(data, "Can't get the size of file."); failf(data, "Can't get the size of file.");
return CURLE_READ_ERROR; return CURLE_READ_ERROR;
} }
else
data->state.resume_from += (curl_off_t)statbuf.st_size; data->state.resume_from += (curl_off_t)statbuf.st_size;
} }

View File

@ -630,7 +630,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_INCOMPLETE; return_value = CURL_FORMADD_INCOMPLETE;
break; break;
} }
else {
if(((form->flags & HTTPPOST_FILENAME) || if(((form->flags & HTTPPOST_FILENAME) ||
(form->flags & HTTPPOST_BUFFER)) && (form->flags & HTTPPOST_BUFFER)) &&
!form->contenttype) { !form->contenttype) {
@ -694,7 +693,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if(form->contenttype) if(form->contenttype)
prevtype = form->contenttype; prevtype = form->contenttype;
} }
}
if(CURL_FORMADD_OK != return_value) { if(CURL_FORMADD_OK != return_value) {
/* On error, free allocated fields for nodes of the FormInfo linked /* On error, free allocated fields for nodes of the FormInfo linked
list which are not already owned by the httppost linked list list which are not already owned by the httppost linked list
@ -1463,7 +1461,6 @@ static size_t readfromfile(struct Form *form, char *buffer,
if(callback) { if(callback) {
if(form->fread_func == ZERO_NULL) if(form->fread_func == ZERO_NULL)
return 0; return 0;
else
nread = form->fread_func(buffer, 1, size, form->data->line); nread = form->fread_func(buffer, 1, size, form->data->line);
} }
else { else {

View File

@ -916,7 +916,6 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
return bits; return bits;
} }
else
return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks); return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
} }
@ -1209,7 +1208,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
possibly_non_local = FALSE; /* don't try this again */ possibly_non_local = FALSE; /* don't try this again */
continue; continue;
} }
else if(error != EADDRINUSE && error != EACCES) { if(error != EADDRINUSE && error != EACCES) {
failf(data, "bind(port=%hu) failed: %s", port, failf(data, "bind(port=%hu) failed: %s", port,
Curl_strerror(conn, error) ); Curl_strerror(conn, error) );
Curl_closesocket(conn, portsock); Curl_closesocket(conn, portsock);
@ -1307,7 +1306,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
} }
break; break;
} }
else if(PORT == fcmd) { if(PORT == fcmd) {
char *source = myhost; char *source = myhost;
char *dest = tmp; char *dest = tmp;
@ -1674,13 +1673,12 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
} }
if(seekerr != CURL_SEEKFUNC_OK) { if(seekerr != CURL_SEEKFUNC_OK) {
curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) { if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream"); failf(data, "Could not seek stream");
return CURLE_FTP_COULDNT_USE_REST; return CURLE_FTP_COULDNT_USE_REST;
} }
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
do { do {
size_t readthisamountnow = size_t readthisamountnow =
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
@ -1699,7 +1697,6 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
} }
} while(passed < data->state.resume_from); } while(passed < data->state.resume_from);
} }
}
/* now, decrease the size of the read */ /* now, decrease the size of the read */
if(data->state.infilesize>0) { if(data->state.infilesize>0) {
data->state.infilesize -= data->state.resume_from; data->state.infilesize -= data->state.resume_from;
@ -2412,7 +2409,6 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
return CURLE_OK; return CURLE_OK;
} }
else
return InitiateTransfer(conn); return InitiateTransfer(conn);
} }
@ -2948,13 +2944,11 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
state(conn, FTP_NAMEFMT); state(conn, FTP_NAMEFMT);
break; break;
} }
else {
/* Nothing special for the target server. */ /* Nothing special for the target server. */
/* remember target server OS */ /* remember target server OS */
Curl_safefree(ftpc->server_os); Curl_safefree(ftpc->server_os);
ftpc->server_os = os; ftpc->server_os = os;
} }
}
else { else {
/* Cannot identify server OS. Continue anyway and cross fingers. */ /* Cannot identify server OS. Continue anyway and cross fingers. */
} }
@ -3800,13 +3794,11 @@ static CURLcode init_wc_data(struct connectdata *conn)
result = ftp_parse_url_path(conn); result = ftp_parse_url_path(conn);
return result; return result;
} }
else {
wildcard->pattern = strdup(last_slash); wildcard->pattern = strdup(last_slash);
if(!wildcard->pattern) if(!wildcard->pattern)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
last_slash[0] = '\0'; /* cut file from path */ last_slash[0] = '\0'; /* cut file from path */
} }
}
else { /* there is only 'wildcard pattern' or nothing */ else { /* there is only 'wildcard pattern' or nothing */
if(path[0]) { if(path[0]) {
wildcard->pattern = strdup(path); wildcard->pattern = strdup(path);
@ -3890,7 +3882,6 @@ static CURLcode wc_statemach(struct connectdata *conn)
if(wildcard->state == CURLWC_CLEAN) if(wildcard->state == CURLWC_CLEAN)
/* only listing! */ /* only listing! */
break; break;
else
wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING; wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
break; break;
@ -3909,7 +3900,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
wildcard->state = CURLWC_CLEAN; wildcard->state = CURLWC_CLEAN;
return wc_statemach(conn); return wc_statemach(conn);
} }
else if(wildcard->filelist->size == 0) { if(wildcard->filelist->size == 0) {
/* no corresponding file */ /* no corresponding file */
wildcard->state = CURLWC_CLEAN; wildcard->state = CURLWC_CLEAN;
return CURLE_REMOTE_FILE_NOT_FOUND; return CURLE_REMOTE_FILE_NOT_FOUND;

View File

@ -433,11 +433,9 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen; return bufflen;
} }
else {
parser->state.UNIX.main = PL_UNIX_FILETYPE; parser->state.UNIX.main = PL_UNIX_FILETYPE;
finfo->b_used = 0; finfo->b_used = 0;
} }
}
else { else {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen; return bufflen;

View File

@ -91,11 +91,9 @@ Curl_hash_init(struct curl_hash *h,
} }
return 0; /* fine */ return 0; /* fine */
} }
else {
h->slots = 0; h->slots = 0;
return 1; /* failure */ return 1; /* failure */
} }
}
static struct curl_hash_element * static struct curl_hash_element *
mk_hash_element(const void *key, size_t key_len, const void *p) mk_hash_element(const void *key, size_t key_len, const void *p)
@ -347,11 +345,9 @@ Curl_hash_next_element(struct curl_hash_iterator *iter)
struct curl_hash_element *he = iter->current_element->ptr; struct curl_hash_element *he = iter->current_element->ptr;
return he; return he;
} }
else {
iter->current_element = NULL; iter->current_element = NULL;
return NULL; return NULL;
} }
}
#if 0 /* useful function for debugging hashes and their contents */ #if 0 /* useful function for debugging hashes and their contents */
void Curl_hash_print(struct curl_hash *h, void Curl_hash_print(struct curl_hash *h,

View File

@ -87,7 +87,7 @@ static int hostmatch(char *hostname, char *pattern)
if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0) if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0)
return CURL_HOST_NOMATCH; return CURL_HOST_NOMATCH;
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
else if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0) if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
return CURL_HOST_NOMATCH; return CURL_HOST_NOMATCH;
#endif #endif

View File

@ -1197,7 +1197,6 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
This needs FIXing. This needs FIXing.
*/ */
return CURLE_SEND_ERROR; return CURLE_SEND_ERROR;
else
Curl_pipeline_leave_write(conn); Curl_pipeline_leave_write(conn);
} }
} }
@ -2156,13 +2155,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
} }
if(seekerr != CURL_SEEKFUNC_OK) { if(seekerr != CURL_SEEKFUNC_OK) {
curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) { if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream"); failf(data, "Could not seek stream");
return CURLE_READ_ERROR; return CURLE_READ_ERROR;
} }
/* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
do { do {
size_t readthisamountnow = size_t readthisamountnow =
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
@ -2182,7 +2181,6 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
} }
} while(passed < data->state.resume_from); } while(passed < data->state.resume_from);
} }
}
/* now, decrease the size of the read */ /* now, decrease the size of the read */
if(data->state.infilesize>0) { if(data->state.infilesize>0) {
@ -2827,7 +2825,6 @@ checkrtspprefix(struct Curl_easy *data,
#endif /* CURL_DOES_CONVERSIONS */ #endif /* CURL_DOES_CONVERSIONS */
if(checkprefix("RTSP/", s)) if(checkprefix("RTSP/", s))
return TRUE; return TRUE;
else
return FALSE; return FALSE;
} }
#endif /* CURL_DISABLE_RTSP */ #endif /* CURL_DISABLE_RTSP */

View File

@ -293,11 +293,9 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(!Curl_conn_data_pending(conn, sockindex)) if(!Curl_conn_data_pending(conn, sockindex))
/* return so we'll be called again polling-style */ /* return so we'll be called again polling-style */
return CURLE_OK; return CURLE_OK;
else {
DEBUGF(infof(data, DEBUGF(infof(data,
"Read response immediately from proxy CONNECT\n")); "Read response immediately from proxy CONNECT\n"));
} }
}
/* at this point, the tunnel_connecting phase is over. */ /* at this point, the tunnel_connecting phase is over. */
@ -342,7 +340,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
} }
continue; continue;
} }
else if(result) { if(result) {
keepon = FALSE; keepon = FALSE;
break; break;
} }
@ -617,12 +615,10 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(conn->bits.proxy_connect_closed) if(conn->bits.proxy_connect_closed)
/* this is not an error, just part of the connection negotiation */ /* this is not an error, just part of the connection negotiation */
return CURLE_OK; return CURLE_OK;
else {
failf(data, "Received HTTP code %d from proxy after CONNECT", failf(data, "Received HTTP code %d from proxy after CONNECT",
data->req.httpcode); data->req.httpcode);
return CURLE_RECV_ERROR; return CURLE_RECV_ERROR;
} }
}
conn->tunnel_state[sockindex] = TUNNEL_COMPLETE; conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;

View File

@ -1096,7 +1096,6 @@ char *curl_maprintf(const char *format, ...)
info.buffer[info.len] = 0; /* we terminate this with a zero byte */ info.buffer[info.len] = 0; /* we terminate this with a zero byte */
return info.buffer; return info.buffer;
} }
else
return strdup(""); return strdup("");
} }
@ -1121,7 +1120,6 @@ char *curl_mvaprintf(const char *format, va_list ap_save)
info.buffer[info.len] = 0; /* we terminate this with a zero byte */ info.buffer[info.len] = 0; /* we terminate this with a zero byte */
return info.buffer; return info.buffer;
} }
else
return strdup(""); return strdup("");
} }

View File

@ -959,11 +959,9 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
if(s == CURL_SOCKET_BAD) if(s == CURL_SOCKET_BAD)
/* this socket is unused, break out of loop */ /* this socket is unused, break out of loop */
break; break;
else {
if((int)s > this_max_fd) if((int)s > this_max_fd)
this_max_fd = (int)s; this_max_fd = (int)s;
} }
}
data = data->next; /* check next handle */ data = data->next; /* check next handle */
} }
@ -2277,7 +2275,6 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
return CURLM_OK; return CURLM_OK;
} }
else
return CURLM_BAD_HANDLE; return CURLM_BAD_HANDLE;
} }
@ -2313,7 +2310,6 @@ CURLMsg *curl_multi_info_read(struct Curl_multi *multi, int *msgs_in_queue)
return &msg->extmsg; return &msg->extmsg;
} }
else
return NULL; return NULL;
} }
@ -2575,7 +2571,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
/* or should we fall-through and do the timer-based stuff? */ /* or should we fall-through and do the timer-based stuff? */
return result; return result;
} }
else if(s != CURL_SOCKET_TIMEOUT) { if(s != CURL_SOCKET_TIMEOUT) {
struct Curl_sh_entry *entry = sh_getentry(&multi->sockhash, s); struct Curl_sh_entry *entry = sh_getentry(&multi->sockhash, s);

View File

@ -58,7 +58,6 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
flags = sfcntl(sockfd, F_GETFL, 0); flags = sfcntl(sockfd, F_GETFL, 0);
if(nonblock) if(nonblock)
return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK); return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
else
return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
#elif defined(HAVE_IOCTL_FIONBIO) #elif defined(HAVE_IOCTL_FIONBIO)

View File

@ -267,7 +267,7 @@ long Curl_pgrsLimitWaitTime(curl_off_t cursize,
if(actual < minimum) if(actual < minimum)
/* this is a conversion on some systems (64bit time_t => 32bit long) */ /* this is a conversion on some systems (64bit time_t => 32bit long) */
return (long)(minimum - actual); return (long)(minimum - actual);
else
return 0; return 0;
} }
@ -454,7 +454,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
failf(data, "Callback aborted"); failf(data, "Callback aborted");
return result; return result;
} }
else if(data->set.fprogress) { if(data->set.fprogress) {
/* The older deprecated callback is set, call that */ /* The older deprecated callback is set, call that */
result= data->set.fprogress(data->set.progress_client, result= data->set.fprogress(data->set.progress_client,
(double)data->progress.size_dl, (double)data->progress.size_dl,

View File

@ -216,7 +216,7 @@ static CURLcode rtsp_done(struct connectdata *conn,
CSeq_sent, CSeq_recv); CSeq_sent, CSeq_recv);
return CURLE_RTSP_CSEQ_ERROR; return CURLE_RTSP_CSEQ_ERROR;
} }
else if(data->set.rtspreq == RTSPREQ_RECEIVE && if(data->set.rtspreq == RTSPREQ_RECEIVE &&
(conn->proto.rtspc.rtp_channel == -1)) { (conn->proto.rtspc.rtp_channel == -1)) {
infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv); infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv);
/* TODO CPC: Server -> Client logic here */ /* TODO CPC: Server -> Client logic here */
@ -648,7 +648,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
*readmore = TRUE; *readmore = TRUE;
break; break;
} }
else {
/* We have the full RTP interleaved packet /* We have the full RTP interleaved packet
* Write out the header including the leading '$' */ * Write out the header including the leading '$' */
DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n", DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n",
@ -674,7 +673,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
k->keepon &= ~KEEP_RECV; k->keepon &= ~KEEP_RECV;
} }
} }
}
else { else {
/* Need more - incomplete header */ /* Need more - incomplete header */
*readmore = TRUE; *readmore = TRUE;
@ -703,7 +701,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
*nread = 0; *nread = 0;
return CURLE_OK; return CURLE_OK;
} }
else {
/* Fix up k->str to point just after the last RTP packet */ /* Fix up k->str to point just after the last RTP packet */
k->str += *nread - rtp_dataleft; k->str += *nread - rtp_dataleft;
@ -716,7 +713,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */ DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */
*nread = rtp_dataleft; *nread = rtp_dataleft;
}
/* If we get here, we have finished with the leftover/merge buffer */ /* If we get here, we have finished with the leftover/merge buffer */
Curl_safefree(rtspc->rtp_buf); Curl_safefree(rtspc->rtp_buf);

View File

@ -565,10 +565,9 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
failf(data, "Write callback asked for PAUSE when not supported!"); failf(data, "Write callback asked for PAUSE when not supported!");
return CURLE_WRITE_ERROR; return CURLE_WRITE_ERROR;
} }
else
return pausewrite(data, type, ptr, len); return pausewrite(data, type, ptr, len);
} }
else if(wrote != chunklen) { if(wrote != chunklen) {
failf(data, "Failed writing body (%zu != %zu)", wrote, chunklen); failf(data, "Failed writing body (%zu != %zu)", wrote, chunklen);
return CURLE_WRITE_ERROR; return CURLE_WRITE_ERROR;
} }
@ -652,7 +651,6 @@ CURLcode Curl_read_plain(curl_socket_t sockfd,
#endif #endif
if(return_error) if(return_error)
return CURLE_AGAIN; return CURLE_AGAIN;
else
return CURLE_RECV_ERROR; return CURLE_RECV_ERROR;
} }

View File

@ -73,7 +73,7 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */
result = Curl_read_plain(sockfd, buf, buffersize, &nread); result = Curl_read_plain(sockfd, buf, buffersize, &nread);
if(CURLE_AGAIN == result) if(CURLE_AGAIN == result)
continue; continue;
else if(result) if(result)
break; break;
if(buffersize == nread) { if(buffersize == nread) {
@ -416,7 +416,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
failf(conn->data, "SOCKS5: no connection here"); failf(conn->data, "SOCKS5: no connection here");
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
else if(0 == result) { if(0 == result) {
failf(conn->data, "SOCKS5: connection timeout"); failf(conn->data, "SOCKS5: connection timeout");
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
@ -457,7 +457,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
failf(conn->data, "SOCKS5 nothing to read"); failf(conn->data, "SOCKS5 nothing to read");
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
else if(0 == result) { if(0 == result) {
failf(conn->data, "SOCKS5 read timeout"); failf(conn->data, "SOCKS5 read timeout");
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
@ -553,7 +553,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
"SOCKS5 GSSAPI per-message authentication is not supported."); "SOCKS5 GSSAPI per-message authentication is not supported.");
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
else if(socksreq[1] == 255) { if(socksreq[1] == 255) {
#endif #endif
if(!proxy_name || !*proxy_name) { if(!proxy_name || !*proxy_name) {
failf(data, failf(data,
@ -772,9 +772,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
} }
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
else {
infof(data, "SOCKS5 request granted.\n"); infof(data, "SOCKS5 request granted.\n");
}
(void)curlx_nonblock(sock, TRUE); (void)curlx_nonblock(sock, TRUE);
return CURLE_OK; /* Proxy was successful! */ return CURLE_OK; /* Proxy was successful! */

View File

@ -55,11 +55,9 @@ CURLcode Curl_speedcheck(struct Curl_easy *data,
data->set.low_speed_time); data->set.low_speed_time);
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
else {
/* wait complete low_speed_time */ /* wait complete low_speed_time */
Curl_expire_latest(data, nextcheck); Curl_expire_latest(data, nextcheck);
} }
}
else { else {
/* we keep up the required speed all right */ /* we keep up the required speed all right */
data->state.keeps_speed = now; data->state.keeps_speed = now;

View File

@ -201,11 +201,9 @@ struct Curl_tree *Curl_splaygetbest(struct timeval i,
return x; return x;
} }
else {
*removed = NULL; /* no match */ *removed = NULL; /* no match */
return t; /* It wasn't there */ return t; /* It wasn't there */
} }
}
/* Deletes the very node we point out from the tree if it's there. Stores a /* Deletes the very node we point out from the tree if it's there. Stores a

105
lib/ssh.c
View File

@ -688,13 +688,10 @@ static CURLcode ssh_check_fingerprint(struct connectdata *conn)
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION; sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode; return sshc->actualcode;
} }
else {
infof(data, "MD5 checksum match!\n"); infof(data, "MD5 checksum match!\n");
/* as we already matched, we skip the check for known hosts */ /* as we already matched, we skip the check for known hosts */
return CURLE_OK; return CURLE_OK;
} }
}
else
return ssh_knownhost(conn); return ssh_knownhost(conn);
} }
@ -738,7 +735,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc) { if(rc) {
failf(data, "Failure establishing ssh session"); failf(data, "Failure establishing ssh session");
state(conn, SSH_SESSION_FREE); state(conn, SSH_SESSION_FREE);
sshc->actualcode = CURLE_FAILED_INIT; sshc->actualcode = CURLE_FAILED_INIT;
@ -782,7 +779,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_AUTH_DONE); state(conn, SSH_AUTH_DONE);
break; break;
} }
else {
err = libssh2_session_last_errno(sshc->ssh_session); err = libssh2_session_last_errno(sshc->ssh_session);
if(err == LIBSSH2_ERROR_EAGAIN) if(err == LIBSSH2_ERROR_EAGAIN)
rc = LIBSSH2_ERROR_EAGAIN; rc = LIBSSH2_ERROR_EAGAIN;
@ -792,7 +788,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
} }
break; break;
} }
}
infof(data, "SSH authentication methods available: %s\n", infof(data, "SSH authentication methods available: %s\n",
sshc->authlist); sshc->authlist);
@ -942,7 +937,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc == 0) { if(rc == 0) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Initialized password authentication\n"); infof(data, "Initialized password authentication\n");
state(conn, SSH_AUTH_DONE); state(conn, SSH_AUTH_DONE);
@ -1081,7 +1076,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc == 0) { if(rc == 0) {
sshc->authed = TRUE; sshc->authed = TRUE;
infof(data, "Initialized keyboard interactive authentication\n"); infof(data, "Initialized keyboard interactive authentication\n");
} }
@ -1120,13 +1115,12 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/ */
sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session); sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session);
if(!sshc->sftp_session) { if(!sshc->sftp_session) {
char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) == if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) { LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN; rc = LIBSSH2_ERROR_EAGAIN;
break; break;
} }
else {
char *err_msg;
(void)libssh2_session_last_error(sshc->ssh_session, (void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0); &err_msg, NULL, 0);
@ -1135,7 +1129,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = CURLE_FAILED_INIT; sshc->actualcode = CURLE_FAILED_INIT;
break; break;
} }
}
state(conn, SSH_SFTP_REALPATH); state(conn, SSH_SFTP_REALPATH);
break; break;
@ -1151,7 +1144,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc > 0) { if(rc > 0) {
/* It seems that this string is not always NULL terminated */ /* It seems that this string is not always NULL terminated */
tempHome[rc] = '\0'; tempHome[rc] = '\0';
sshc->homedir = strdup(tempHome); sshc->homedir = strdup(tempHome);
@ -1265,7 +1258,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_NEXT_QUOTE); state(conn, SSH_SFTP_NEXT_QUOTE);
break; break;
} }
else if(cmd) { if(cmd) {
/* /*
* the arguments following the command must be separated from the * the arguments following the command must be separated from the
* command with a space so we can check for it unconditionally * command with a space so we can check for it unconditionally
@ -1325,7 +1318,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_QUOTE_STAT); state(conn, SSH_SFTP_QUOTE_STAT);
break; break;
} }
else if(strncasecompare(cmd, "ln ", 3) || if(strncasecompare(cmd, "ln ", 3) ||
strncasecompare(cmd, "symlink ", 8)) { strncasecompare(cmd, "symlink ", 8)) {
/* symbolic linking */ /* symbolic linking */
/* sshc->quote_path1 is the source */ /* sshc->quote_path1 is the source */
@ -1447,7 +1440,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { /* get those attributes */ if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2); Curl_safefree(sshc->quote_path2);
@ -1518,7 +1511,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2); Curl_safefree(sshc->quote_path2);
@ -1541,7 +1534,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2); Curl_safefree(sshc->quote_path2);
@ -1562,7 +1555,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err)); failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err));
@ -1586,7 +1579,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2); Curl_safefree(sshc->quote_path2);
@ -1605,7 +1598,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err)); failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err));
@ -1623,7 +1616,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
failf(data, "rm command failed: %s", sftp_libssh2_strerror(err)); failf(data, "rm command failed: %s", sftp_libssh2_strerror(err));
@ -1646,7 +1639,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc != 0 && !sshc->acceptfail) { if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
failf(data, "statvfs command failed: %s", sftp_libssh2_strerror(err)); failf(data, "statvfs command failed: %s", sftp_libssh2_strerror(err));
@ -1709,7 +1702,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc == 0) { if(rc == 0) {
data->info.filetime = (long)attrs.mtime; data->info.filetime = (long)attrs.mtime;
} }
@ -1747,7 +1740,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc) { if(rc) {
data->state.resume_from = 0; data->state.resume_from = 0;
} }
else { else {
@ -1782,7 +1775,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(LIBSSH2_ERROR_EAGAIN == rc) if(LIBSSH2_ERROR_EAGAIN == rc)
break; break;
else {
if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc) if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)
/* only when there was an SFTP protocol error can we extract /* only when there was an SFTP protocol error can we extract
the sftp error! */ the sftp error! */
@ -1798,7 +1791,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sftp_libssh2_strerror(err)); sftp_libssh2_strerror(err));
break; break;
} }
else if(((err == LIBSSH2_FX_NO_SUCH_FILE) || if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
(err == LIBSSH2_FX_FAILURE) || (err == LIBSSH2_FX_FAILURE) ||
(err == LIBSSH2_FX_NO_SUCH_PATH)) && (err == LIBSSH2_FX_NO_SUCH_PATH)) &&
(data->set.ftp_create_missing_dirs && (data->set.ftp_create_missing_dirs &&
@ -1824,7 +1817,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
err, rc); err, rc);
break; break;
} }
}
/* If we have a restart point then we need to seek to the correct /* If we have a restart point then we need to seek to the correct
position. */ position. */
@ -1836,14 +1828,13 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
} }
if(seekerr != CURL_SEEKFUNC_OK) { if(seekerr != CURL_SEEKFUNC_OK) {
curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) { if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream"); failf(data, "Could not seek stream");
return CURLE_FTP_COULDNT_USE_REST; return CURLE_FTP_COULDNT_USE_REST;
} }
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
do { do {
size_t readthisamountnow = size_t readthisamountnow =
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
@ -1862,7 +1853,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
} }
} while(passed < data->state.resume_from); } while(passed < data->state.resume_from);
} }
}
/* now, decrease the size of the read */ /* now, decrease the size of the read */
if(data->state.infilesize > 0) { if(data->state.infilesize > 0) {
@ -1926,9 +1916,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_CREATE_DIRS_MKDIR); state(conn, SSH_SFTP_CREATE_DIRS_MKDIR);
break; break;
} }
else {
state(conn, SSH_SFTP_UPLOAD_INIT); state(conn, SSH_SFTP_UPLOAD_INIT);
}
break; break;
case SSH_SFTP_CREATE_DIRS_MKDIR: case SSH_SFTP_CREATE_DIRS_MKDIR:
@ -1956,10 +1944,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH; sshc->actualcode = result?result:CURLE_SSH;
break; break;
} }
else {
rc = 0; /* clear rc and continue */ rc = 0; /* clear rc and continue */
} }
}
state(conn, SSH_SFTP_CREATE_DIRS); state(conn, SSH_SFTP_CREATE_DIRS);
break; break;
@ -1985,7 +1971,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN; rc = LIBSSH2_ERROR_EAGAIN;
break; break;
} }
else {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
failf(data, "Could not open directory for reading: %s", failf(data, "Could not open directory for reading: %s",
sftp_libssh2_strerror(err)); sftp_libssh2_strerror(err));
@ -1994,7 +1979,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH; sshc->actualcode = result?result:CURLE_SSH;
break; break;
} }
}
sshc->readdir_filename = malloc(PATH_MAX+1); sshc->readdir_filename = malloc(PATH_MAX+1);
if(!sshc->readdir_filename) { if(!sshc->readdir_filename) {
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
@ -2200,7 +2184,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN; rc = LIBSSH2_ERROR_EAGAIN;
break; break;
} }
else {
err = sftp_libssh2_last_error(sshc->sftp_session); err = sftp_libssh2_last_error(sshc->sftp_session);
failf(data, "Could not open remote file for reading: %s", failf(data, "Could not open remote file for reading: %s",
sftp_libssh2_strerror(err)); sftp_libssh2_strerror(err));
@ -2209,7 +2192,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH; sshc->actualcode = result?result:CURLE_SSH;
break; break;
} }
}
state(conn, SSH_SFTP_DOWNLOAD_STAT); state(conn, SSH_SFTP_DOWNLOAD_STAT);
break; break;
@ -2223,7 +2205,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc || if(rc ||
!(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) || !(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) ||
(attrs.filesize == 0)) { (attrs.filesize == 0)) {
/* /*
@ -2321,7 +2303,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_STOP); state(conn, SSH_STOP);
break; break;
} }
else {
Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size, Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,
FALSE, NULL, -1, NULL); FALSE, NULL, -1, NULL);
@ -2332,7 +2313,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
out writableable as the underlying libssh2 recv function will deal out writableable as the underlying libssh2 recv function will deal
with both accordingly */ with both accordingly */
conn->cselect_bits = CURL_CSELECT_IN; conn->cselect_bits = CURL_CSELECT_IN;
}
if(result) { if(result) {
/* this should never occur; the close state should be entered /* this should never occur; the close state should be entered
at the time the error occurs */ at the time the error occurs */
@ -2350,7 +2331,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to close libssh2 file\n"); infof(data, "Failed to close libssh2 file\n");
} }
sshc->sftp_handle = NULL; sshc->sftp_handle = NULL;
@ -2384,7 +2365,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to close libssh2 file\n"); infof(data, "Failed to close libssh2 file\n");
} }
sshc->sftp_handle = NULL; sshc->sftp_handle = NULL;
@ -2394,7 +2375,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to stop libssh2 sftp subsystem\n"); infof(data, "Failed to stop libssh2 sftp subsystem\n");
} }
sshc->sftp_session = NULL; sshc->sftp_session = NULL;
@ -2439,14 +2420,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms, SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,
data->state.infilesize); data->state.infilesize);
if(!sshc->ssh_channel) { if(!sshc->ssh_channel) {
int ssh_err;
char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) == if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) { LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN; rc = LIBSSH2_ERROR_EAGAIN;
break; break;
} }
else {
int ssh_err;
char *err_msg;
ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session, ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0)); &err_msg, NULL, 0));
@ -2455,7 +2436,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err); sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
break; break;
} }
}
/* upload data */ /* upload data */
Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL, Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL,
@ -2509,14 +2489,15 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
#endif #endif
if(!sshc->ssh_channel) { if(!sshc->ssh_channel) {
int ssh_err;
char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) == if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) { LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN; rc = LIBSSH2_ERROR_EAGAIN;
break; break;
} }
else {
int ssh_err;
char *err_msg;
ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session, ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0)); &err_msg, NULL, 0));
@ -2525,7 +2506,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err); sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
break; break;
} }
}
/* download data */ /* download data */
bytecount = (curl_off_t)sb.st_size; bytecount = (curl_off_t)sb.st_size;
@ -2562,7 +2542,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc) { if(rc) {
infof(data, "Failed to send libssh2 channel EOF\n"); infof(data, "Failed to send libssh2 channel EOF\n");
} }
} }
@ -2575,7 +2555,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc) { if(rc) {
infof(data, "Failed to get channel EOF: %d\n", rc); infof(data, "Failed to get channel EOF: %d\n", rc);
} }
} }
@ -2588,7 +2568,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc) { if(rc) {
infof(data, "Channel failed to close: %d\n", rc); infof(data, "Channel failed to close: %d\n", rc);
} }
} }
@ -2601,7 +2581,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n"); infof(data, "Failed to free libssh2 scp subsystem\n");
} }
sshc->ssh_channel = NULL; sshc->ssh_channel = NULL;
@ -2623,7 +2603,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n"); infof(data, "Failed to free libssh2 scp subsystem\n");
} }
sshc->ssh_channel = NULL; sshc->ssh_channel = NULL;
@ -2634,7 +2614,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to disconnect libssh2 session\n"); infof(data, "Failed to disconnect libssh2 session\n");
} }
} }
@ -2659,7 +2639,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to disconnect from libssh2 agent\n"); infof(data, "Failed to disconnect from libssh2 agent\n");
} }
libssh2_agent_free(sshc->ssh_agent); libssh2_agent_free(sshc->ssh_agent);
@ -2677,7 +2657,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
else if(rc < 0) { if(rc < 0) {
infof(data, "Failed to free libssh2 session\n"); infof(data, "Failed to free libssh2 session\n");
} }
sshc->ssh_session = NULL; sshc->ssh_session = NULL;
@ -2843,6 +2823,7 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
while((sshc->state != SSH_STOP) && !result) { while((sshc->state != SSH_STOP) && !result) {
bool block; bool block;
long left; long left;
struct timeval now = Curl_tvnow();
result = ssh_statemach_act(conn, &block); result = ssh_statemach_act(conn, &block);
if(result) if(result)
@ -2850,12 +2831,10 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
if(Curl_pgrsUpdate(conn)) if(Curl_pgrsUpdate(conn))
return CURLE_ABORTED_BY_CALLBACK; return CURLE_ABORTED_BY_CALLBACK;
else {
struct timeval now = Curl_tvnow();
result = Curl_speedcheck(data, now); result = Curl_speedcheck(data, now);
if(result) if(result)
break; break;
}
left = Curl_timeleft(data, NULL, duringconnect); left = Curl_timeleft(data, NULL, duringconnect);
if(left < 0) { if(left < 0) {

View File

@ -125,7 +125,7 @@ int Curl_safe_strcasecompare(const char *first, const char *second)
if(first && second) if(first && second)
/* both pointers point to something then compare them */ /* both pointers point to something then compare them */
return Curl_strcasecompare(first, second); return Curl_strcasecompare(first, second);
else
/* if both pointers are NULL then treat them as equal */ /* if both pointers are NULL then treat them as equal */
return (NULL == first && NULL == second); return (NULL == first && NULL == second);
} }

View File

@ -899,12 +899,10 @@ static CURLcode check_telnet_options(struct connectdata *conn)
result = CURLE_UNKNOWN_TELNET_OPTION; result = CURLE_UNKNOWN_TELNET_OPTION;
break; break;
} }
else {
failf(data, "Syntax error in telnet option: %s", head->data); failf(data, "Syntax error in telnet option: %s", head->data);
result = CURLE_TELNET_OPTION_SYNTAX; result = CURLE_TELNET_OPTION_SYNTAX;
break; break;
} }
}
if(result) { if(result) {
curl_slist_free_all(tn->telnet_vars); curl_slist_free_all(tn->telnet_vars);
@ -1594,7 +1592,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(result == CURLE_AGAIN) if(result == CURLE_AGAIN)
break; break;
/* returned not-zero, this an error */ /* returned not-zero, this an error */
else if(result) { if(result) {
keepon = FALSE; keepon = FALSE;
break; break;
} }

View File

@ -359,7 +359,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
failf(data, "invalid blocksize value in OACK packet"); failf(data, "invalid blocksize value in OACK packet");
return CURLE_TFTP_ILLEGAL; return CURLE_TFTP_ILLEGAL;
} }
else if(blksize > TFTP_BLKSIZE_MAX) { if(blksize > TFTP_BLKSIZE_MAX) {
failf(data, "%s (%d)", "blksize is larger than max supported", failf(data, "%s (%d)", "blksize is larger than max supported",
TFTP_BLKSIZE_MAX); TFTP_BLKSIZE_MAX);
return CURLE_TFTP_ILLEGAL; return CURLE_TFTP_ILLEGAL;
@ -1189,7 +1189,7 @@ static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event)
state->state = TFTP_STATE_FIN; state->state = TFTP_STATE_FIN;
return 0; return 0;
} }
else if(current > state->rx_time+state->retry_time) { if(current > state->rx_time+state->retry_time) {
if(event) if(event)
*event = TFTP_EVENT_TIMEOUT; *event = TFTP_EVENT_TIMEOUT;
time(&state->rx_time); /* update even though we received nothing */ time(&state->rx_time); /* update even though we received nothing */
@ -1223,7 +1223,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
failf(data, "TFTP response timeout"); failf(data, "TFTP response timeout");
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
else if(event != TFTP_EVENT_NONE) { if(event != TFTP_EVENT_NONE) {
result = tftp_state_machine(state, event); result = tftp_state_machine(state, event);
if(result) if(result)
return result; return result;

View File

@ -139,7 +139,6 @@ double curlx_tvdiff_secs(struct timeval newer, struct timeval older)
if(newer.tv_sec != older.tv_sec) if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+ return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0; (double)(newer.tv_usec-older.tv_usec)/1000000.0;
else
return (double)(newer.tv_usec-older.tv_usec)/1000000.0; return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
} }

View File

@ -117,7 +117,8 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
*nreadp = 0; *nreadp = 0;
return CURLE_ABORTED_BY_CALLBACK; return CURLE_ABORTED_BY_CALLBACK;
} }
else if(nread == CURL_READFUNC_PAUSE) { if(nread == CURL_READFUNC_PAUSE) {
struct SingleRequest *k = &data->req;
if(conn->handler->flags & PROTOPT_NONETWORK) { if(conn->handler->flags & PROTOPT_NONETWORK) {
/* protocols that work without network cannot be paused. This is /* protocols that work without network cannot be paused. This is
@ -126,8 +127,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
failf(data, "Read callback asked for PAUSE when not supported!"); failf(data, "Read callback asked for PAUSE when not supported!");
return CURLE_READ_ERROR; return CURLE_READ_ERROR;
} }
else {
struct SingleRequest *k = &data->req;
/* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */ /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */ k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
if(data->req.upload_chunky) { if(data->req.upload_chunky) {
@ -135,7 +135,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
data->req.upload_fromhere -= (8 + 2); data->req.upload_fromhere -= (8 + 2);
} }
*nreadp = 0; *nreadp = 0;
}
return CURLE_OK; /* nothing was read */ return CURLE_OK; /* nothing was read */
} }
else if((size_t)nread > buffersize) { else if((size_t)nread > buffersize) {
@ -642,7 +642,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res)); failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res));
return CURLE_RECV_ERROR; return CURLE_RECV_ERROR;
} }
else if(CHUNKE_STOP == res) { if(CHUNKE_STOP == res) {
size_t dataleft; size_t dataleft;
/* we're done reading chunks! */ /* we're done reading chunks! */
k->keepon &= ~KEEP_RECV; /* read no more */ k->keepon &= ~KEEP_RECV; /* read no more */
@ -918,7 +918,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
/* this is a paused transfer */ /* this is a paused transfer */
break; break;
} }
else if(nread<=0) { if(nread<=0) {
result = done_sending(conn, k); result = done_sending(conn, k);
if(result) if(result)
return result; return result;
@ -1192,7 +1192,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->size - k->bytecount); k->size - k->bytecount);
return CURLE_PARTIAL_FILE; return CURLE_PARTIAL_FILE;
} }
else if(!(data->set.opt_no_body) && if(!(data->set.opt_no_body) &&
k->chunk && k->chunk &&
(conn->chunk.state != CHUNK_STOP)) { (conn->chunk.state != CHUNK_STOP)) {
/* /*

View File

@ -3684,7 +3684,7 @@ ConnectionExists(struct Curl_easy *data,
check->connection_id)); check->connection_id));
continue; continue;
} }
else if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) { if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) {
foundPendingCandidate = TRUE; foundPendingCandidate = TRUE;
DEBUGF(infof(data, DEBUGF(infof(data,
"Connection #%ld has not started SSL connect, " "Connection #%ld has not started SSL connect, "

View File

@ -775,7 +775,7 @@ int Curl_ossl_check_cxn(struct connectdata *conn)
(RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK); (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK);
if(nread == 0) if(nread == 0)
return 0; /* connection has been closed */ return 0; /* connection has been closed */
else if(nread == 1) if(nread == 1)
return 1; /* connection still in place */ return 1; /* connection still in place */
else if(nread == -1) { else if(nread == -1) {
int err = SOCKERRNO; int err = SOCKERRNO;
@ -2085,13 +2085,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
ssl_capath ? ssl_capath : "none"); ssl_capath ? ssl_capath : "none");
return CURLE_SSL_CACERT_BADFILE; return CURLE_SSL_CACERT_BADFILE;
} }
else {
/* Just continue with a warning if no strict certificate verification /* Just continue with a warning if no strict certificate verification
is required. */ is required. */
infof(data, "error setting certificate verify locations," infof(data, "error setting certificate verify locations,"
" continuing anyway:\n"); " continuing anyway:\n");
} }
}
else { else {
/* Everything is fine. */ /* Everything is fine. */
infof(data, "successfully set certificate verify locations:\n"); infof(data, "successfully set certificate verify locations:\n");
@ -2120,12 +2118,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
failf(data, "error loading CRL file: %s", ssl_crlfile); failf(data, "error loading CRL file: %s", ssl_crlfile);
return CURLE_SSL_CRL_BADFILE; return CURLE_SSL_CRL_BADFILE;
} }
else {
/* Everything is fine. */ /* Everything is fine. */
infof(data, "successfully load CRL file:\n"); infof(data, "successfully load CRL file:\n");
X509_STORE_set_flags(SSL_CTX_get_cert_store(connssl->ctx), X509_STORE_set_flags(SSL_CTX_get_cert_store(connssl->ctx),
X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL); X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
}
infof(data, " CRLfile: %s\n", ssl_crlfile); infof(data, " CRLfile: %s\n", ssl_crlfile);
} }
@ -2253,7 +2250,7 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
connssl->connecting_state = ssl_connect_2_reading; connssl->connecting_state = ssl_connect_2_reading;
return CURLE_OK; return CURLE_OK;
} }
else if(SSL_ERROR_WANT_WRITE == detail) { if(SSL_ERROR_WANT_WRITE == detail) {
connssl->connecting_state = ssl_connect_2_writing; connssl->connecting_state = ssl_connect_2_writing;
return CURLE_OK; return CURLE_OK;
} }
@ -3066,17 +3063,15 @@ static CURLcode ossl_connect_common(struct connectdata *conn,
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
else if(0 == what) { if(0 == what) {
if(nonblocking) { if(nonblocking) {
*done = FALSE; *done = FALSE;
return CURLE_OK; return CURLE_OK;
} }
else {
/* timeout */ /* timeout */
failf(data, "SSL connection timeout"); failf(data, "SSL connection timeout");
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
}
/* socket is readable or writable */ /* socket is readable or writable */
} }
@ -3145,7 +3140,6 @@ bool Curl_ossl_data_pending(const struct connectdata *conn, int connindex)
(conn->proxy_ssl[connindex].handle && (conn->proxy_ssl[connindex].handle &&
0 != SSL_pending(conn->proxy_ssl[connindex].handle))) ? 0 != SSL_pending(conn->proxy_ssl[connindex].handle))) ?
TRUE : FALSE; TRUE : FALSE;
else
return FALSE; return FALSE;
} }

View File

@ -515,7 +515,7 @@ int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
socks[0] = conn->sock[FIRSTSOCKET]; socks[0] = conn->sock[FIRSTSOCKET];
return GETSOCK_WRITESOCK(0); return GETSOCK_WRITESOCK(0);
} }
else if(connssl->connecting_state == ssl_connect_2_reading) { if(connssl->connecting_state == ssl_connect_2_reading) {
/* read mode */ /* read mode */
socks[0] = conn->sock[FIRSTSOCKET]; socks[0] = conn->sock[FIRSTSOCKET];
return GETSOCK_READSOCK(0); return GETSOCK_READSOCK(0);

View File

@ -128,7 +128,6 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
hdrcbdata->honor_cd_filename = FALSE; hdrcbdata->honor_cd_filename = FALSE;
break; break;
} }
else
return failure; return failure;
} }
} }

View File

@ -783,13 +783,12 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(!url) if(!url)
return PARAM_NO_MEM; return PARAM_NO_MEM;
else {
/* fill in the URL */ /* fill in the URL */
GetStr(&url->url, nextarg); GetStr(&url->url, nextarg);
url->flags |= GETOUT_URL; url->flags |= GETOUT_URL;
} }
} }
}
break; break;
case '$': /* more options without a short option */ case '$': /* more options without a short option */
switch(subletter) { switch(subletter) {
@ -878,7 +877,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
&config->localportrange); &config->localportrange);
if(!rc) if(!rc)
return PARAM_BAD_USE; return PARAM_BAD_USE;
else if(rc == 1) if(rc == 1)
config->localportrange = 1; /* default number of ports to try */ config->localportrange = 1; /* default number of ports to try */
else { else {
config->localportrange -= config->localport; config->localportrange -= config->localport;
@ -1728,7 +1727,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(!url) if(!url)
return PARAM_NO_MEM; return PARAM_NO_MEM;
else {
/* fill in the outfile */ /* fill in the outfile */
if('o' == letter) { if('o' == letter) {
GetStr(&url->outfile, nextarg); GetStr(&url->outfile, nextarg);
@ -1743,7 +1742,6 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
} }
url->flags |= GETOUT_OUTFILE; url->flags |= GETOUT_OUTFILE;
} }
}
break; break;
case 'P': case 'P':
/* This makes the FTP sessions use PORT instead of PASV */ /* This makes the FTP sessions use PORT instead of PASV */
@ -1867,7 +1865,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(!url) if(!url)
return PARAM_NO_MEM; return PARAM_NO_MEM;
else {
url->flags |= GETOUT_UPLOAD; /* mark -T used */ url->flags |= GETOUT_UPLOAD; /* mark -T used */
if(!*nextarg) if(!*nextarg)
url->flags |= GETOUT_NOUPLOAD; url->flags |= GETOUT_NOUPLOAD;
@ -1876,7 +1874,6 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&url->infile, nextarg); GetStr(&url->infile, nextarg);
} }
} }
}
break; break;
case 'u': case 'u':
/* user:password */ /* user:password */

View File

@ -207,7 +207,6 @@ static bool ttyecho(bool enable, int fd)
#endif #endif
return TRUE; /* disabled */ return TRUE; /* disabled */
} }
else {
/* re-enable echo, assumes we disabled it before (and set the structs we /* re-enable echo, assumes we disabled it before (and set the structs we
now use to reset the terminal status) */ now use to reset the terminal status) */
#ifdef HAVE_TERMIOS_H #ifdef HAVE_TERMIOS_H
@ -219,7 +218,6 @@ static bool ttyecho(bool enable, int fd)
#endif #endif
return TRUE; /* enabled */ return TRUE; /* enabled */
} }
}
char *getpass_r(const char *prompt, /* prompt to display */ char *getpass_r(const char *prompt, /* prompt to display */
char *password, /* buffer to store password in */ char *password, /* buffer to store password in */

View File

@ -135,7 +135,6 @@ double tool_tvdiff_secs(struct timeval newer, struct timeval older)
if(newer.tv_sec != older.tv_sec) if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+ return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0; (double)(newer.tv_usec-older.tv_usec)/1000000.0;
else
return (double)(newer.tv_usec-older.tv_usec)/1000000.0; return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
} }