mirror of
https://github.com/curl/curl.git
synced 2026-08-01 08:08:04 +03:00
parent
08f97cbf5c
commit
b2bccdc257
49 changed files with 113 additions and 113 deletions
|
|
@ -61,7 +61,7 @@ static int my_seek(void *userp, curl_off_t offset, int origin)
|
|||
{
|
||||
FILE *fp = (FILE *) userp;
|
||||
|
||||
if(-1 == fseek(fp, (long) offset, origin))
|
||||
if(fseek(fp, (long) offset, origin) == -1)
|
||||
/* could not seek */
|
||||
return CURL_SEEKFUNC_CANTSEEK;
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static struct ip *ip_list_append(struct ip *list, const char *data)
|
|||
ip->maskbits = 128;
|
||||
#endif
|
||||
|
||||
if(1 != inet_pton(ip->family, ip->str, &ip->netaddr)) {
|
||||
if(inet_pton(ip->family, ip->str, &ip->netaddr) != 1) {
|
||||
free(ip->str);
|
||||
free(ip);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ int main(void)
|
|||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
if(0 != error)
|
||||
if(error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static int sftpResumeUpload(CURL *curlhandle, const char *remotepath,
|
|||
CURLcode result = CURLE_GOT_NOTHING;
|
||||
|
||||
curl_off_t remoteFileSizeByte = sftpGetRemoteFileSize(remotepath);
|
||||
if(-1 == remoteFileSizeByte) {
|
||||
if(remoteFileSizeByte == -1) {
|
||||
printf("Error reading the remote file size: unable to resume upload\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void *create_thread(void *progress_bar)
|
|||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
NULL);
|
||||
if(0 != error)
|
||||
if(error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ int main(int argc, char **argv)
|
|||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
if(0 != error)
|
||||
if(error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ If no parenthesis, use the default indent:
|
|||
|
||||
```c
|
||||
data->set.http_disable_hostname_check_before_authentication =
|
||||
(0 != va_arg(param, long)) ? TRUE : FALSE;
|
||||
va_arg(param, long) ? TRUE : FALSE;
|
||||
```
|
||||
|
||||
Function invoke with an open parenthesis:
|
||||
|
|
|
|||
|
|
@ -260,11 +260,11 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
|
|||
#ifdef USE_IPV6
|
||||
else {
|
||||
char ipv6_unused[16];
|
||||
if(1 == curlx_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) {
|
||||
if(curlx_inet_pton(AF_INET6, as->dst.host, ipv6_unused) == 1) {
|
||||
dst6_pre = "[";
|
||||
dst6_post = "]";
|
||||
}
|
||||
if(1 == curlx_inet_pton(AF_INET6, as->src.host, ipv6_unused)) {
|
||||
if(curlx_inet_pton(AF_INET6, as->src.host, ipv6_unused) == 1) {
|
||||
src6_pre = "[";
|
||||
src6_post = "]";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
|||
|
||||
#endif
|
||||
|
||||
if(0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
|
||||
if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
|
||||
err = SOCKERRNO;
|
||||
#ifdef UNDER_CE
|
||||
/* Old Windows CE versions do not support SO_ERROR */
|
||||
|
|
@ -860,7 +860,7 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
|||
err = 0;
|
||||
}
|
||||
#endif
|
||||
if((0 == err) || (SOCKEISCONN == err))
|
||||
if((err == 0) || (SOCKEISCONN == err))
|
||||
/* we are connected, awesome! */
|
||||
rc = TRUE;
|
||||
else
|
||||
|
|
@ -2111,7 +2111,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(0 == getsockname(ctx->sock, (struct sockaddr *) &add, &size)) {
|
||||
if(!getsockname(ctx->sock, (struct sockaddr *) &add, &size)) {
|
||||
size = sizeof(add);
|
||||
#ifdef HAVE_ACCEPT4
|
||||
s_accepted = accept4(ctx->sock, (struct sockaddr *) &add, &size,
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ static bool cpool_foreach(struct Curl_easy *data,
|
|||
struct connectdata *conn = Curl_node_elem(curr);
|
||||
curr = Curl_node_next(curr);
|
||||
|
||||
if(1 == func(data, conn, param)) {
|
||||
if(func(data, conn, param) == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,13 +167,13 @@ static bool pathmatch(const char *cookie_path, const char *uri_path)
|
|||
|
||||
/* cookie_path must not have last '/' separator. ex: /sample */
|
||||
cookie_path_len = strlen(cookie_path);
|
||||
if(1 == cookie_path_len) {
|
||||
if(cookie_path_len == 1) {
|
||||
/* cookie_path must be '/' */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* #-fragments are already cut off! */
|
||||
if(0 == strlen(uri_path) || uri_path[0] != '/')
|
||||
if(strlen(uri_path) == 0 || uri_path[0] != '/')
|
||||
uri_path = "/";
|
||||
|
||||
/*
|
||||
|
|
@ -872,7 +872,7 @@ parse_netscape(struct Cookie *co,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(6 == fields) {
|
||||
if(fields == 6) {
|
||||
/* we got a cookie with blank contents, fix it */
|
||||
co->value = strdup("");
|
||||
if(!co->value)
|
||||
|
|
@ -881,7 +881,7 @@ parse_netscape(struct Cookie *co,
|
|||
fields++;
|
||||
}
|
||||
|
||||
if(7 != fields)
|
||||
if(fields != 7)
|
||||
/* we did not find the sufficient number of fields */
|
||||
return CERR_FIELDS;
|
||||
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ curl_dbg_getaddrinfo(const char *hostname,
|
|||
#else
|
||||
int res = getaddrinfo(hostname, service, hints, result);
|
||||
#endif
|
||||
if(0 == res)
|
||||
if(res == 0)
|
||||
/* success */
|
||||
curl_dbg_log("ADDR %s:%d getaddrinfo() = %p\n",
|
||||
source, line, (void *)*result);
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ static CURL_FORCEINLINE curl_uint64_t Curl_rotr64(curl_uint64_t value,
|
|||
unsigned int bits)
|
||||
{
|
||||
bits %= 64;
|
||||
if(0 == bits)
|
||||
if(bits == 0)
|
||||
return value;
|
||||
/* Defined in a form which modern compiler could optimize. */
|
||||
return (value >> bits) | (value << (64 - bits));
|
||||
|
|
@ -621,7 +621,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
|||
|
||||
DEBUGASSERT((data != NULL) || (length == 0));
|
||||
|
||||
if(0 == length)
|
||||
if(length == 0)
|
||||
return CURLE_OK; /* Shortcut, do nothing */
|
||||
|
||||
/* Note: (count & (CURL_SHA512_256_BLOCK_SIZE-1))
|
||||
|
|
@ -633,7 +633,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
|||
ctx->count_bits_hi += ctx->count >> 61;
|
||||
ctx->count &= CURL_UINT64_C(0x1FFFFFFFFFFFFFFF);
|
||||
|
||||
if(0 != bytes_have) {
|
||||
if(bytes_have) {
|
||||
unsigned int bytes_left = CURL_SHA512_256_BLOCK_SIZE - bytes_have;
|
||||
if(length >= bytes_left) {
|
||||
/* Combine new data with data in the buffer and process the full
|
||||
|
|
@ -656,7 +656,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
|||
length -= CURL_SHA512_256_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
if(0 != length) {
|
||||
if(length) {
|
||||
/* Copy incomplete block of new data (if any)
|
||||
to the buffer. */
|
||||
memcpy(((unsigned char *) ctx_buf) + bytes_have, data, length);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ struct curltime curlx_now(void)
|
|||
(HAVE_BUILTIN_AVAILABLE == 1)
|
||||
have_clock_gettime &&
|
||||
#endif
|
||||
(0 == clock_gettime(CLOCK_MONOTONIC_RAW, &tsnow))) {
|
||||
(clock_gettime(CLOCK_MONOTONIC_RAW, &tsnow) == 0)) {
|
||||
cnow.tv_sec = tsnow.tv_sec;
|
||||
cnow.tv_usec = (int)(tsnow.tv_nsec / 1000);
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ struct curltime curlx_now(void)
|
|||
(HAVE_BUILTIN_AVAILABLE == 1)
|
||||
have_clock_gettime &&
|
||||
#endif
|
||||
(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow))) {
|
||||
(clock_gettime(CLOCK_MONOTONIC, &tsnow) == 0)) {
|
||||
cnow.tv_sec = tsnow.tv_sec;
|
||||
cnow.tv_usec = (int)(tsnow.tv_nsec / 1000);
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ struct curltime curlx_now(void)
|
|||
struct curltime cnow;
|
||||
uint64_t usecs;
|
||||
|
||||
if(0 == timebase.denom)
|
||||
if(timebase.denom == 0)
|
||||
(void)mach_timebase_info(&timebase);
|
||||
|
||||
usecs = mach_absolute_time();
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ static CURLcode file_upload(struct Curl_easy *data,
|
|||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
|
||||
if(-1 != data->state.infilesize)
|
||||
if(data->state.infilesize != -1)
|
||||
/* known size of data to "upload" */
|
||||
Curl_pgrsSetUploadSize(data, data->state.infilesize);
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
|
|||
fd = file->fd;
|
||||
|
||||
/* VMS: This only works reliable for STREAMLF files */
|
||||
if(-1 != fstat(fd, &statbuf)) {
|
||||
if(fstat(fd, &statbuf) != -1) {
|
||||
if(!S_ISDIR(statbuf.st_mode))
|
||||
expected_size = statbuf.st_size;
|
||||
/* and store the modification time */
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ static CURLcode ftp_readresp(struct Curl_easy *data,
|
|||
if(ftpcode)
|
||||
*ftpcode = code;
|
||||
|
||||
if(421 == code) {
|
||||
if(code == 421) {
|
||||
/* 421 means "Service not available, closing control connection." and FTP
|
||||
* servers use it to signal that idle session timeout has been exceeded.
|
||||
* If we ignored the response, it could end up hanging in some cases.
|
||||
|
|
@ -2356,7 +2356,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
|
|||
|
||||
if(instate == FTP_SIZE) {
|
||||
#ifdef CURL_FTP_HTTPSTYLE_HEAD
|
||||
if(-1 != filesize) {
|
||||
if(filesize != -1) {
|
||||
char clbuf[128];
|
||||
int clbuflen = msnprintf(clbuf, sizeof(clbuf),
|
||||
"Content-Length: %" FMT_OFF_T "\r\n", filesize);
|
||||
|
|
@ -3439,7 +3439,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
|
|||
}
|
||||
}
|
||||
else {
|
||||
if((-1 != data->req.size) &&
|
||||
if((data->req.size != -1) &&
|
||||
(data->req.size != data->req.bytecount) &&
|
||||
(data->req.maxdownload != data->req.bytecount)) {
|
||||
failf(data, "Received only partial file: %" FMT_OFF_T " bytes",
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
|
|||
* The AI_NUMERICHOST must not be set to get synthesized IPv6 address from
|
||||
* an IPv4 address on iOS and macOS.
|
||||
*/
|
||||
if((1 == curlx_inet_pton(AF_INET, hostname, addrbuf)) ||
|
||||
(1 == curlx_inet_pton(AF_INET6, hostname, addrbuf))) {
|
||||
if((curlx_inet_pton(AF_INET, hostname, addrbuf) == 1) ||
|
||||
(curlx_inet_pton(AF_INET6, hostname, addrbuf) == 1)) {
|
||||
/* the given address is numerical only, prevent a reverse lookup */
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3949,7 +3949,7 @@ static CURLcode http_on_response(struct Curl_easy *data,
|
|||
like to call http2_handle_stream_close to properly close a
|
||||
stream. In order to do this, we keep reading until we
|
||||
close the stream. */
|
||||
if((0 == k->maxdownload) && (k->httpversion_sent < 20))
|
||||
if((k->maxdownload == 0) && (k->httpversion_sent < 20))
|
||||
k->download_done = TRUE;
|
||||
|
||||
/* final response without error, prepare to receive the body */
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
|||
}
|
||||
else {
|
||||
const char *p;
|
||||
if(0 == ch->hexindex) {
|
||||
if(ch->hexindex == 0) {
|
||||
/* This is illegal data, we received junk where we expected
|
||||
a hexadecimal digit. */
|
||||
failf(data, "chunk hex-length char not a hex digit: 0x%x", *buf);
|
||||
|
|
@ -184,7 +184,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
|||
/* waiting for the LF after a chunk size */
|
||||
if(*buf == 0x0a) {
|
||||
/* we are now expecting data to come, unless size was zero! */
|
||||
if(0 == ch->datasize) {
|
||||
if(ch->datasize == 0) {
|
||||
ch->state = CHUNK_TRAILER; /* now check for trailers */
|
||||
}
|
||||
else {
|
||||
|
|
@ -229,7 +229,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
|||
FMT_OFF_T " bytes in chunk remain",
|
||||
piece, ch->datasize);
|
||||
|
||||
if(0 == ch->datasize)
|
||||
if(ch->datasize == 0)
|
||||
/* end of data this round, we now expect a trailing CRLF */
|
||||
ch->state = CHUNK_POSTLF;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ int curl_dbg_socketpair(int domain, int type, int protocol,
|
|||
{
|
||||
int res = (socketpair)(domain, type, protocol, socket_vector);
|
||||
|
||||
if(source && (0 == res))
|
||||
if(source && (res == 0))
|
||||
curl_dbg_log("FD %s:%d socketpair() = "
|
||||
"%" FMT_SOCKET_T " %" FMT_SOCKET_T "\n",
|
||||
source, line, socket_vector[0], socket_vector[1]);
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */
|
|||
/* strange input */
|
||||
return FALSE;
|
||||
|
||||
if(1 != curlx_inet_pton(AF_INET, ipv4, &address))
|
||||
if(curlx_inet_pton(AF_INET, ipv4, &address) != 1)
|
||||
return FALSE;
|
||||
if(1 != curlx_inet_pton(AF_INET, network, &check))
|
||||
if(curlx_inet_pton(AF_INET, network, &check) != 1)
|
||||
return FALSE;
|
||||
|
||||
if(bits && (bits != 32)) {
|
||||
|
|
@ -92,9 +92,9 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6,
|
|||
rest = bits & 0x07;
|
||||
if((bytes > 16) || ((bytes == 16) && rest))
|
||||
return FALSE;
|
||||
if(1 != curlx_inet_pton(AF_INET6, ipv6, address))
|
||||
if(curlx_inet_pton(AF_INET6, ipv6, address) != 1)
|
||||
return FALSE;
|
||||
if(1 != curlx_inet_pton(AF_INET6, network, check))
|
||||
if(curlx_inet_pton(AF_INET6, network, check) != 1)
|
||||
return FALSE;
|
||||
if(bytes && memcmp(address, check, bytes))
|
||||
return FALSE;
|
||||
|
|
@ -163,7 +163,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
|
|||
else {
|
||||
unsigned int address;
|
||||
namelen = strlen(name);
|
||||
if(1 == curlx_inet_pton(AF_INET, name, &address))
|
||||
if(curlx_inet_pton(AF_INET, name, &address) == 1)
|
||||
type = TYPE_IPV4;
|
||||
else {
|
||||
/* ignore trailing dots in the hostname */
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
|
|||
|
||||
/* Figure out the exact time for the time span */
|
||||
span_ms = curlx_timediff(now, p->speeder_time[checkindex]);
|
||||
if(0 == span_ms)
|
||||
if(span_ms == 0)
|
||||
span_ms = 1; /* at least one millisecond MUST have passed */
|
||||
|
||||
/* Calculate the average speed the last 'span_ms' milliseconds */
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ static CURLcode cw_download_write(struct Curl_easy *data,
|
|||
* This gives deterministic BODY writes on varying buffer receive
|
||||
* lengths. */
|
||||
nwrite = nbytes;
|
||||
if(-1 != data->req.maxdownload) {
|
||||
if(data->req.maxdownload != -1) {
|
||||
size_t wmax = get_max_body_write_len(data, data->req.maxdownload);
|
||||
if(nwrite > wmax) {
|
||||
excess_len = nbytes - wmax;
|
||||
|
|
@ -879,7 +879,7 @@ static CURLcode cr_in_rewind(struct Curl_easy *data,
|
|||
int err = fseek(data->state.in, 0, SEEK_SET);
|
||||
CURL_TRC_READ(data, "cr_in, rewind via fseek -> %d(%d)",
|
||||
(int)err, (int)errno);
|
||||
if(-1 != err)
|
||||
if(err != -1)
|
||||
/* successful rewind */
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ static void set_ssl_options(struct ssl_config_data *ssl,
|
|||
static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
|
||||
long arg)
|
||||
{
|
||||
bool enabled = (0 != arg);
|
||||
bool enabled = !!arg;
|
||||
unsigned long uarg = (unsigned long)arg;
|
||||
switch(option) {
|
||||
case CURLOPT_DNS_CACHE_TIMEOUT:
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ CONNECT_RESOLVE_REMOTE:
|
|||
#ifdef USE_IPV6
|
||||
if(conn->bits.ipv6_ip) {
|
||||
char ip6[16];
|
||||
if(1 != curlx_inet_pton(AF_INET6, sx->hostname, ip6))
|
||||
if(curlx_inet_pton(AF_INET6, sx->hostname, ip6) != 1)
|
||||
return CURLPX_BAD_ADDRESS_TYPE;
|
||||
socksreq[len++] = 4;
|
||||
memcpy(&socksreq[len], ip6, sizeof(ip6));
|
||||
|
|
@ -884,7 +884,7 @@ CONNECT_RESOLVE_REMOTE:
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if(1 == curlx_inet_pton(AF_INET, sx->hostname, ip4)) {
|
||||
if(curlx_inet_pton(AF_INET, sx->hostname, ip4) == 1) {
|
||||
socksreq[len++] = 1;
|
||||
memcpy(&socksreq[len], ip4, sizeof(ip4));
|
||||
len += sizeof(ip4);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
|
||||
code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4,
|
||||
FALSE, &nwritten);
|
||||
if(code || (4 != nwritten)) {
|
||||
if(code || (nwritten != 4)) {
|
||||
failf(data, "Failed to send GSS-API authentication request.");
|
||||
gss_release_name(&gss_status, &server);
|
||||
gss_release_buffer(&gss_status, &gss_recv_token);
|
||||
|
|
@ -420,7 +420,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
|
||||
code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
|
||||
&nwritten);
|
||||
if(code || (4 != nwritten)) {
|
||||
if(code || (nwritten != 4)) {
|
||||
failf(data, "Failed to send GSS-API encryption request.");
|
||||
gss_release_buffer(&gss_status, &gss_w_token);
|
||||
Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
|
|
@ -431,7 +431,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
memcpy(socksreq, &gss_enc, 1);
|
||||
code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 1, FALSE,
|
||||
&nwritten);
|
||||
if(code || (1 != nwritten)) {
|
||||
if(code || (nwritten != 1)) {
|
||||
failf(data, "Failed to send GSS-API encryption type.");
|
||||
Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
|
||||
code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
|
||||
&written);
|
||||
if(code || (4 != written)) {
|
||||
if(code || (written != 4)) {
|
||||
failf(data, "Failed to send SSPI authentication request.");
|
||||
free(service_name);
|
||||
if(sspi_send_token.pvBuffer)
|
||||
|
|
@ -480,7 +480,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
|
||||
code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
|
||||
&written);
|
||||
if(code || (4 != written)) {
|
||||
if(code || (written != 4)) {
|
||||
failf(data, "Failed to send SSPI encryption request.");
|
||||
if(sspi_send_token.pvBuffer)
|
||||
Curl_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);
|
||||
|
|
@ -492,7 +492,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
memcpy(socksreq, &gss_enc, 1);
|
||||
code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 1, FALSE,
|
||||
&written);
|
||||
if(code || (1 != written)) {
|
||||
if(code || (written != 1)) {
|
||||
failf(data, "Failed to send SSPI encryption type.");
|
||||
Curl_pSecFn->DeleteSecurityContext(&sspi_context);
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static int ncasecompare(const char *first, const char *second, size_t max)
|
|||
first++;
|
||||
second++;
|
||||
}
|
||||
if(0 == max)
|
||||
if(max == 0)
|
||||
return 1; /* they are equal this far */
|
||||
|
||||
return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
|
||||
|
|
|
|||
|
|
@ -809,7 +809,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
|
|||
* storage is supplied via 'strerrbuf' and 'buflen' to hold the generated
|
||||
* message string, or EINVAL if 'errnum' is not a valid error number.
|
||||
*/
|
||||
if(0 != strerror_r(err, buf, buflen)) {
|
||||
if(strerror_r(err, buf, buflen)) {
|
||||
if('\0' == buf[0])
|
||||
curl_msnprintf(buf, buflen, "Unknown error %d", err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ CURLcode Curl_sendrecv(struct Curl_easy *data, struct curltime *nowp)
|
|||
}
|
||||
|
||||
/* If there is nothing more to send/recv, the request is done */
|
||||
if(0 == (k->keepon&(KEEP_RECVBITS|KEEP_SENDBITS)))
|
||||
if((k->keepon & (KEEP_RECVBITS|KEEP_SENDBITS)) == 0)
|
||||
data->req.done = TRUE;
|
||||
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
|
|||
{
|
||||
char dest[16]; /* fits a binary IPv6 address */
|
||||
hostname[hlen] = 0; /* end the address there */
|
||||
if(1 != curlx_inet_pton(AF_INET6, hostname, dest))
|
||||
if(curlx_inet_pton(AF_INET6, hostname, dest) != 1)
|
||||
return CURLUE_BAD_IPV6;
|
||||
if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen)) {
|
||||
hlen = strlen(hostname); /* might be shorter now */
|
||||
|
|
|
|||
|
|
@ -1967,7 +1967,7 @@ static bool gtls_data_pending(struct Curl_cfilter *cf,
|
|||
DEBUGASSERT(ctx && ctx->backend);
|
||||
backend = (struct gtls_ssl_backend_data *)ctx->backend;
|
||||
if(backend->gtls.session &&
|
||||
0 != gnutls_record_check_pending(backend->gtls.session))
|
||||
gnutls_record_check_pending(backend->gtls.session) != 0)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -958,7 +958,7 @@ static char *ossl_strerror(unsigned long error, char *buf, size_t size)
|
|||
static int passwd_callback(char *buf, int num, int encrypting,
|
||||
void *password)
|
||||
{
|
||||
DEBUGASSERT(0 == encrypting);
|
||||
DEBUGASSERT(encrypting == 0);
|
||||
|
||||
if(!encrypting && num >= 0 && password) {
|
||||
int klen = curlx_uztosi(strlen((char *)password));
|
||||
|
|
@ -975,7 +975,7 @@ static int passwd_callback(char *buf, int num, int encrypting,
|
|||
*/
|
||||
static bool rand_enough(void)
|
||||
{
|
||||
return 0 != RAND_status();
|
||||
return RAND_status() != 0;
|
||||
}
|
||||
|
||||
static CURLcode ossl_seed(struct Curl_easy *data)
|
||||
|
|
@ -4487,7 +4487,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
|
|||
/* 1 is fine
|
||||
0 is "not successful but was shut down controlled"
|
||||
<0 is "handshake was not successful, because a fatal error occurred" */
|
||||
if(1 != err) {
|
||||
if(err != 1) {
|
||||
int detail = SSL_get_error(octx->ssl, err);
|
||||
CURL_TRC_CF(data, cf, "SSL_connect() -> err=%d, detail=%d", err, detail);
|
||||
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
|
|||
{
|
||||
const char *startCur = ciphers;
|
||||
int algCount = 0;
|
||||
while(startCur && (0 != *startCur) && (algCount < NUM_CIPHERS)) {
|
||||
while(startCur && *startCur && (algCount < NUM_CIPHERS)) {
|
||||
curl_off_t alg;
|
||||
if(curlx_str_number(&startCur, &alg, INT_MAX) || !alg)
|
||||
alg = get_alg_id_by_name(startCur);
|
||||
|
|
@ -1816,7 +1816,7 @@ schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
result = CURLE_SEND_ERROR;
|
||||
break;
|
||||
}
|
||||
else if(0 == what) {
|
||||
else if(what == 0) {
|
||||
failf(data, "schannel: timed out sending data "
|
||||
"(bytes sent: %zu)", *pnwritten);
|
||||
result = CURLE_OPERATION_TIMEDOUT;
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ static CURLcode pubkey_pem_to_der(const char *pem,
|
|||
|
||||
pem_count = begin_pos - pem;
|
||||
/* Invalid if not at beginning AND not directly following \n */
|
||||
if(0 != pem_count && '\n' != pem[pem_count - 1])
|
||||
if(pem_count && '\n' != pem[pem_count - 1])
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
|
||||
/* 26 is length of "-----BEGIN PUBLIC KEY-----" */
|
||||
|
|
@ -1790,7 +1790,7 @@ static CURLcode vtls_shutdown_blocking(struct Curl_cfilter *cf,
|
|||
result = CURLE_RECV_ERROR;
|
||||
goto out;
|
||||
}
|
||||
else if(0 == what) {
|
||||
else if(what == 0) {
|
||||
/* timeout */
|
||||
failf(data, "SSL shutdown timeout");
|
||||
result = CURLE_OPERATION_TIMEDOUT;
|
||||
|
|
|
|||
|
|
@ -1759,7 +1759,7 @@ static CURLcode wssl_handshake(struct Curl_cfilter *cf,
|
|||
}
|
||||
}
|
||||
#ifdef USE_ECH_WOLFSSL
|
||||
else if(-1 == detail) {
|
||||
else if(detail == -1) {
|
||||
/* try access a retry_config ECHConfigList for tracing */
|
||||
byte echConfigs[1000];
|
||||
word32 echConfigsLen = 1000;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ CURLcode create_dir_hierarchy(const char *outfile, struct GlobalConfig *global)
|
|||
|
||||
/* Create directory. Ignore access denied error to allow traversal. */
|
||||
/* !checksrc! disable ERRNOVAR 1 */
|
||||
if(!skip && (-1 == mkdir(curlx_dyn_ptr(&dirbuf), (mode_t)0000750)) &&
|
||||
if(!skip && (mkdir(curlx_dyn_ptr(&dirbuf), (mode_t)0000750) == -1) &&
|
||||
(errno != EACCES) && (errno != EEXIST)) {
|
||||
show_dir_errno(global, curlx_dyn_ptr(&dirbuf));
|
||||
result = CURLE_WRITE_ERROR;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
|
|||
}
|
||||
#else
|
||||
struct_stat statbuf;
|
||||
if(-1 != stat(filename, &statbuf)) {
|
||||
if(stat(filename, &statbuf) != -1) {
|
||||
*stamp = (curl_off_t)statbuf.st_mtime;
|
||||
rc = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,7 @@ static ParameterError parse_time_cond(struct OperationConfig *config,
|
|||
break;
|
||||
}
|
||||
config->condtime = (curl_off_t)curl_getdate(nextarg, NULL);
|
||||
if(-1 == config->condtime) {
|
||||
if(config->condtime == -1) {
|
||||
curl_off_t value;
|
||||
/* now let's see if it is a filename to get the time from instead! */
|
||||
int rc = getfiletime(nextarg, config->global, &value);
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ char *getpass_r(const char *prompt, /* prompt to display */
|
|||
ssize_t nread;
|
||||
bool disabled;
|
||||
int fd = open("/dev/tty", O_RDONLY);
|
||||
if(-1 == fd)
|
||||
if(fd == -1)
|
||||
fd = STDIN_FILENO; /* use stdin if the tty could not be used */
|
||||
|
||||
disabled = ttyecho(FALSE, fd); /* disable terminal echo */
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void voutf(struct GlobalConfig *global,
|
|||
while(!ISBLANK(ptr[cut]) && cut) {
|
||||
cut--;
|
||||
}
|
||||
if(0 == cut)
|
||||
if(cut == 0)
|
||||
/* not a single cutting position was found, just cut it at the
|
||||
max text width then! */
|
||||
cut = width-1;
|
||||
|
|
|
|||
|
|
@ -1009,7 +1009,7 @@ static CURLcode setup_outfile(struct OperationConfig *config,
|
|||
of the file as it is now and open it for append instead */
|
||||
struct_stat fileinfo;
|
||||
/* VMS -- Danger, the filesize is only valid for stream files */
|
||||
if(0 == stat(per->outfile, &fileinfo))
|
||||
if(stat(per->outfile, &fileinfo) == 0)
|
||||
/* set offset to current file size: */
|
||||
config->resume_from = fileinfo.st_size;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1194,7 +1194,7 @@ static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags)
|
|||
memset(value, 0, sizeof(value)); /* Avoid valgrind false positive. */
|
||||
memcpy(buf, p, n);
|
||||
buf[n] = 0;
|
||||
if(2 == sscanf(buf, "%79[^=]=%79[^,]", part, value)) {
|
||||
if(sscanf(buf, "%79[^=]=%79[^,]", part, value) == 2) {
|
||||
CURLUPart what = part2id(part);
|
||||
#if 0
|
||||
/* for debugging this */
|
||||
|
|
@ -1888,8 +1888,8 @@ static int clear_url(void)
|
|||
curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
|
||||
|
||||
rc = curl_url_get(u, clear_url_list[i].part, &p, 0);
|
||||
if(rc != clear_url_list[i].ucode || (clear_url_list[i].out &&
|
||||
0 != strcmp(p, clear_url_list[i].out))) {
|
||||
if(rc != clear_url_list[i].ucode ||
|
||||
(clear_url_list[i].out && strcmp(p, clear_url_list[i].out) != 0)) {
|
||||
|
||||
curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
|
||||
error++;
|
||||
|
|
|
|||
|
|
@ -477,8 +477,8 @@ static int test_dnsd(int argc, char **argv)
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static void mqttd_getconfig(void)
|
|||
while(fgets(buffer, sizeof(buffer), fp)) {
|
||||
char key[32];
|
||||
char value[32];
|
||||
if(2 == sscanf(buffer, "%31s %31s", key, value)) {
|
||||
if(sscanf(buffer, "%31s %31s", key, value) == 2) {
|
||||
if(!strcmp(key, "version")) {
|
||||
m_config.version = byteval(value);
|
||||
logmsg("version [%d] set", m_config.version);
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
|
|||
logmsg("instructed to stream");
|
||||
req->rcmd = RCMD_STREAM;
|
||||
}
|
||||
else if(1 == sscanf(ptr, "pipe: %d", &num)) {
|
||||
else if(sscanf(ptr, "pipe: %d", &num) == 1) {
|
||||
logmsg("instructed to allow a pipe size of %d", num);
|
||||
if(num < 0)
|
||||
logmsg("negative pipe size ignored");
|
||||
|
|
@ -277,7 +277,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
|
|||
req->pipe = num-1; /* decrease by one since we don't count the
|
||||
first request in this number */
|
||||
}
|
||||
else if(1 == sscanf(ptr, "skip: %d", &num)) {
|
||||
else if(sscanf(ptr, "skip: %d", &num) == 1) {
|
||||
logmsg("instructed to skip this number of bytes %d", num);
|
||||
req->skip = num;
|
||||
}
|
||||
|
|
@ -784,7 +784,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
|
|||
else {
|
||||
FILE *stream = test2fopen(req->testno, logdir);
|
||||
char partbuf[80]="data";
|
||||
if(0 != req->partno)
|
||||
if(req->partno)
|
||||
snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
|
|
@ -935,7 +935,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
|
|||
int num;
|
||||
ptr = cmd;
|
||||
do {
|
||||
if(2 == sscanf(ptr, "%31s %d", command, &num)) {
|
||||
if(sscanf(ptr, "%31s %d", command, &num) == 2) {
|
||||
if(!strcmp("wait", command)) {
|
||||
logmsg("Told to sleep for %d seconds", num);
|
||||
quarters = num * 4;
|
||||
|
|
@ -1099,8 +1099,8 @@ static int test_rtspd(int argc, char *argv[])
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static void socksd_getconfig(void)
|
|||
while(fgets(buffer, sizeof(buffer), fp)) {
|
||||
char key[32];
|
||||
char value[260];
|
||||
if(2 == sscanf(buffer, "%31s %259s", key, value)) {
|
||||
if(sscanf(buffer, "%31s %259s", key, value) == 2) {
|
||||
if(!strcmp(key, "version")) {
|
||||
s_config.version = byteval(value);
|
||||
logmsg("version [%d] set", s_config.version);
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ static int parse_cmdfile(struct sws_httprequest *req)
|
|||
int testnum = DOCNUMBER_NOTHING;
|
||||
char buf[256];
|
||||
while(fgets(buf, sizeof(buf), f)) {
|
||||
if(1 == sscanf(buf, "Testnum %d", &testnum)) {
|
||||
if(sscanf(buf, "Testnum %d", &testnum) == 1) {
|
||||
logmsg("[%s] cmdfile says testnum %d", cmdfile, testnum);
|
||||
req->testno = testnum;
|
||||
}
|
||||
|
|
@ -255,7 +255,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
|
|||
logmsg("swsclose: close this connection after response");
|
||||
req->close = TRUE;
|
||||
}
|
||||
else if(1 == sscanf(cmd, "skip: %d", &num)) {
|
||||
else if(sscanf(cmd, "skip: %d", &num) == 1) {
|
||||
logmsg("instructed to skip this number of bytes %d", num);
|
||||
req->skip = num;
|
||||
}
|
||||
|
|
@ -263,11 +263,11 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
|
|||
logmsg("instructed to reject Expect: 100-continue");
|
||||
req->noexpect = TRUE;
|
||||
}
|
||||
else if(1 == sscanf(cmd, "delay: %d", &num)) {
|
||||
else if(sscanf(cmd, "delay: %d", &num) == 1) {
|
||||
logmsg("instructed to delay %d msecs after connect", num);
|
||||
req->delay = num;
|
||||
}
|
||||
else if(1 == sscanf(cmd, "writedelay: %d", &num)) {
|
||||
else if(sscanf(cmd, "writedelay: %d", &num) == 1) {
|
||||
logmsg("instructed to delay %d msecs between packets", num);
|
||||
req->writedelay = num;
|
||||
}
|
||||
|
|
@ -1171,7 +1171,7 @@ retry:
|
|||
int num;
|
||||
ptr = cmd;
|
||||
do {
|
||||
if(2 == sscanf(ptr, "%31s %d", command, &num)) {
|
||||
if(sscanf(ptr, "%31s %d", command, &num) == 2) {
|
||||
if(!strcmp("wait", command)) {
|
||||
logmsg("Told to sleep for %d seconds", num);
|
||||
quarters = num * 4;
|
||||
|
|
@ -1243,8 +1243,8 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
if(socket_domain_is_ip()) {
|
||||
/* Disable the Nagle algorithm */
|
||||
curl_socklen_t flag = 1;
|
||||
if(0 != setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
if(setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
logmsg("====> TCP_NODELAY for server connection failed");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1252,7 +1252,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
/* We want to do the connect() in a non-blocking mode, since
|
||||
* Windows has an internal retry logic that may lead to long
|
||||
* timeouts if the peer is not listening. */
|
||||
if(0 != curlx_nonblock(serverfd, TRUE)) {
|
||||
if(curlx_nonblock(serverfd, TRUE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock(TRUE) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1321,10 +1321,10 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
goto error;
|
||||
else if(rc > 0) {
|
||||
curl_socklen_t errSize = sizeof(error);
|
||||
if(0 != getsockopt(serverfd, SOL_SOCKET, SO_ERROR,
|
||||
(void *)&error, &errSize))
|
||||
if(getsockopt(serverfd, SOL_SOCKET, SO_ERROR,
|
||||
(void *)&error, &errSize))
|
||||
error = SOCKERRNO;
|
||||
if((0 == error) || (SOCKEISCONN == error))
|
||||
if((error == 0) || (SOCKEISCONN == error))
|
||||
goto success;
|
||||
else if((error != SOCKEINPROGRESS) && (error != SOCKEWOULDBLOCK))
|
||||
goto error;
|
||||
|
|
@ -1346,7 +1346,7 @@ success:
|
|||
logmsg("connected fine to %s%s%s:%hu, now tunnel",
|
||||
op_br, ipaddr, cl_br, port);
|
||||
|
||||
if(0 != curlx_nonblock(serverfd, FALSE)) {
|
||||
if(curlx_nonblock(serverfd, FALSE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock(FALSE) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1549,8 +1549,8 @@ static void http_connect(curl_socket_t *infdp,
|
|||
if(socket_domain_is_ip()) {
|
||||
/* Disable the Nagle algorithm */
|
||||
curl_socklen_t flag = 1;
|
||||
if(0 != setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
if(setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
logmsg("====> TCP_NODELAY for client DATA connection failed");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1839,7 +1839,7 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
if(0 != curlx_nonblock(msgsock, TRUE)) {
|
||||
if(curlx_nonblock(msgsock, TRUE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1847,8 +1847,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
if(0 != setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_KEEPALIVE) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1877,8 +1877,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
* Disable the Nagle algorithm to make it easier to send out a large
|
||||
* response in many small segments to torture the clients more.
|
||||
*/
|
||||
if(0 != setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
if(setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
logmsg("====> TCP_NODELAY failed");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2162,14 +2162,14 @@ static int test_sws(int argc, char *argv[])
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
goto sws_cleanup;
|
||||
}
|
||||
if(0 != curlx_nonblock(sock, TRUE)) {
|
||||
if(curlx_nonblock(sock, TRUE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ static ssize_t write_behind(struct testcase *test, int convert)
|
|||
}
|
||||
/* formerly
|
||||
putc(c, file); */
|
||||
if(1 != write(test->ofile, &c, 1))
|
||||
if(write(test->ofile, &c, 1) != 1)
|
||||
break;
|
||||
skipit:
|
||||
prevchar = c;
|
||||
|
|
@ -662,8 +662,8 @@ static int test_tftpd(int argc, char **argv)
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1029,7 +1029,7 @@ static int tftpd_parse_servercmd(struct testcase *req)
|
|||
cmd = orgcmd;
|
||||
while(cmd && cmdsize) {
|
||||
char *check;
|
||||
if(1 == sscanf(cmd, "writedelay: %d", &num)) {
|
||||
if(sscanf(cmd, "writedelay: %d", &num) == 1) {
|
||||
logmsg("instructed to delay %d secs between packets", num);
|
||||
req->writedelay = num;
|
||||
}
|
||||
|
|
@ -1118,7 +1118,7 @@ static int validate_access(struct testcase *test,
|
|||
|
||||
stream = test2fopen(testno, logdir);
|
||||
|
||||
if(0 != partno)
|
||||
if(partno)
|
||||
snprintf(partbuf, sizeof(partbuf), "data%ld", partno);
|
||||
|
||||
if(!stream) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue