mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:01:41 +03:00
tidy-up: move literals to right-side of if expressions (where missing)
Closes #20535
This commit is contained in:
parent
c6ac2de5b3
commit
85de995208
57 changed files with 115 additions and 115 deletions
|
|
@ -183,17 +183,17 @@ int main(int argc, const char *argv[])
|
|||
/* get it! */
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
curl_off_t val;
|
||||
|
||||
/* check for bytes downloaded */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Data downloaded: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", val);
|
||||
|
||||
/* check for total download time */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Total download time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
@ -201,7 +201,7 @@ int main(int argc, const char *argv[])
|
|||
|
||||
/* check for average download speed */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Average download speed: "
|
||||
"%" CURL_FORMAT_CURL_OFF_T " kbyte/sec.\n",
|
||||
val / 1024);
|
||||
|
|
@ -209,7 +209,7 @@ int main(int argc, const char *argv[])
|
|||
if(prtall) {
|
||||
/* check for name resolution time */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Name lookup time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
@ -217,7 +217,7 @@ int main(int argc, const char *argv[])
|
|||
|
||||
/* check for connect time */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Connect time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ int main(void)
|
|||
/* clean up the FTP commands list */
|
||||
curl_slist_free_all(headerlist);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ int main(void)
|
|||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,16 +75,16 @@ int main(void)
|
|||
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
/* https://curl.se/libcurl/c/curl_easy_getinfo.html */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if((CURLE_OK == result) && (filetime >= 0)) {
|
||||
if((result == CURLE_OK) && (filetime >= 0)) {
|
||||
time_t file_time = (time_t)filetime;
|
||||
printf("filetime %s: %s", filename, ctime(&file_time));
|
||||
}
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&filesize);
|
||||
if((CURLE_OK == result) && (filesize > 0))
|
||||
if((result == CURLE_OK) && (filesize > 0))
|
||||
printf("filesize %s: %" CURL_FORMAT_CURL_OFF_T " bytes\n",
|
||||
filename, filesize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ int main(void)
|
|||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ int main(void)
|
|||
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
const char *ct;
|
||||
/* ask for the content-type */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
|
||||
|
||||
if((CURLE_OK == result) && ct)
|
||||
if((result == CURLE_OK) && ct)
|
||||
printf("We received Content-Type: %s\n", ct);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ int main(void)
|
|||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
|
|||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&remoteFileSizeByte);
|
||||
if(result)
|
||||
|
|
|
|||
|
|
@ -417,12 +417,12 @@ int main(void)
|
|||
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
char *ct;
|
||||
/* ask for the content-type */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
|
||||
|
||||
if((CURLE_OK == result) && ct)
|
||||
if((result == CURLE_OK) && ct)
|
||||
printf("We received Content-Type: %s\n", ct);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ int main(void)
|
|||
double connect;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", connect);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ int main(void)
|
|||
curl_off_t connect;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
|
||||
(long)(connect % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ int main(void)
|
|||
double connect;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", connect);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ int main(void)
|
|||
curl_off_t connect;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &connect);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
|
||||
(long)(connect % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ int main(void)
|
|||
/* Ask for filetime */
|
||||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
long filetime = 0;
|
||||
result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if((CURLE_OK == result) && (filetime != -1)) {
|
||||
if((result == CURLE_OK) && (filetime != -1)) {
|
||||
time_t file_time = (time_t)filetime;
|
||||
printf("filetime: %s", ctime(&file_time));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ int main(void)
|
|||
/* Ask for filetime */
|
||||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
curl_off_t filetime;
|
||||
result = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
|
||||
if((CURLE_OK == result) && (filetime != -1)) {
|
||||
if((result == CURLE_OK) && (filetime != -1)) {
|
||||
time_t file_time = (time_t)filetime;
|
||||
printf("filetime: %s", ctime(&file_time));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@ int main(void)
|
|||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
long port;
|
||||
result = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("We used local port: %ld\n", port);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ int main(void)
|
|||
double namelookup;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", namelookup);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ int main(void)
|
|||
curl_off_t namelookup;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T,
|
||||
&namelookup);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
|
||||
(long)(namelookup % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ int main(void)
|
|||
CURLcode result;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
curl_off_t posttransfer;
|
||||
result = curl_easy_getinfo(curl, CURLINFO_POSTTRANSFER_TIME_T,
|
||||
&posttransfer);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Request sent after: %" CURL_FORMAT_CURL_OFF_T ".%06ld s",
|
||||
posttransfer / 1000000, (long)(posttransfer % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ int main(void)
|
|||
double pretransfer;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME,
|
||||
&pretransfer);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", pretransfer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ int main(void)
|
|||
curl_off_t pretransfer;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T,
|
||||
&pretransfer);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
|
||||
pretransfer / 1000000,
|
||||
(long)(pretransfer % 1000000));
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ int main(void)
|
|||
curl_off_t queue;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_QUEUE_TIME_T, &queue);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Queued: %" CURL_FORMAT_CURL_OFF_T ".%06ld us", queue / 1000000,
|
||||
(long)(queue % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ int main(void)
|
|||
double redirect;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME, &redirect);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", redirect);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ int main(void)
|
|||
curl_off_t redirect;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &redirect);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", redirect / 1000000,
|
||||
(long)(redirect % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ int main(void)
|
|||
double start;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", start);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ int main(void)
|
|||
curl_off_t start;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T, &start);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
|
||||
(long)(start % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ int main(void)
|
|||
double total;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %.1f", total);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ int main(void)
|
|||
curl_off_t total;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
|
||||
(long)(total % 1000000));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ int main(void)
|
|||
/* Ask for filetime */
|
||||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
long filetime;
|
||||
result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if((CURLE_OK == result) && (filetime >= 0)) {
|
||||
if((result == CURLE_OK) && (filetime >= 0)) {
|
||||
time_t file_time = (time_t)filetime;
|
||||
printf("filetime: %s", ctime(&file_time));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int main(void)
|
|||
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
|
||||
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OPERATION_TIMEDOUT == result) {
|
||||
if(result == CURLE_OPERATION_TIMEDOUT) {
|
||||
printf("Timeout.\n");
|
||||
}
|
||||
/* always cleanup */
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ int main(void)
|
|||
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
|
||||
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OPERATION_TIMEDOUT == result) {
|
||||
if(result == CURLE_OPERATION_TIMEDOUT) {
|
||||
printf("Timeout.\n");
|
||||
}
|
||||
/* always cleanup */
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ CURLcode Curl_socket_open(struct Curl_easy *data,
|
|||
static int socket_close(struct Curl_easy *data, struct connectdata *conn,
|
||||
int use_callback, curl_socket_t sock)
|
||||
{
|
||||
if(CURL_SOCKET_BAD == sock)
|
||||
if(sock == CURL_SOCKET_BAD)
|
||||
return 0;
|
||||
|
||||
if(use_callback && conn && conn->fclosesocket) {
|
||||
|
|
@ -932,7 +932,7 @@ static void cf_socket_close(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
{
|
||||
struct cf_socket_ctx *ctx = cf->ctx;
|
||||
|
||||
if(ctx && CURL_SOCKET_BAD != ctx->sock) {
|
||||
if(ctx && ctx->sock != CURL_SOCKET_BAD) {
|
||||
CURL_TRC_CF(data, cf, "cf_socket_close, fd=%" FMT_SOCKET_T, ctx->sock);
|
||||
if(ctx->sock == cf->conn->sock[cf->sockindex])
|
||||
cf->conn->sock[cf->sockindex] = CURL_SOCKET_BAD;
|
||||
|
|
@ -2065,7 +2065,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf,
|
|||
s_accepted = CURL_ACCEPT(ctx->sock, (struct sockaddr *)&add, &size);
|
||||
#endif
|
||||
|
||||
if(CURL_SOCKET_BAD == s_accepted) {
|
||||
if(s_accepted == CURL_SOCKET_BAD) {
|
||||
failf(data, "Error accept()ing server connect: %s",
|
||||
curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
|
||||
return CURLE_FTP_ACCEPT_FAILED;
|
||||
|
|
|
|||
|
|
@ -871,7 +871,7 @@ CURLcode Curl_conn_cf_cntrl(struct Curl_cfilter *cf,
|
|||
CURLcode result = CURLE_OK;
|
||||
|
||||
for(; cf; cf = cf->next) {
|
||||
if(Curl_cf_def_cntrl == cf->cft->cntrl)
|
||||
if(cf->cft->cntrl == Curl_cf_def_cntrl)
|
||||
continue;
|
||||
result = cf->cft->cntrl(cf, data, event, arg1, arg2);
|
||||
if(!ignore_result && result)
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ static CURLcode cw_out_cb_write(struct cw_out_ctx *ctx,
|
|||
CURL_TRC_WRITE(data, "[OUT] wrote %zu %s bytes -> %zu",
|
||||
blen, (otype == CW_OUT_HDS) ? "header" : "body",
|
||||
nwritten);
|
||||
if(CURL_WRITEFUNC_PAUSE == nwritten) {
|
||||
if(nwritten == CURL_WRITEFUNC_PAUSE) {
|
||||
if(data->conn->scheme->flags & PROTOPT_NONETWORK) {
|
||||
/* Protocols that work without network cannot be paused. This is
|
||||
actually only FILE:// just now, and it cannot pause since the
|
||||
|
|
@ -205,7 +205,7 @@ static CURLcode cw_out_cb_write(struct cw_out_ctx *ctx,
|
|||
result = Curl_xfer_pause_recv(data, TRUE);
|
||||
return result ? result : CURLE_AGAIN;
|
||||
}
|
||||
else if(CURL_WRITEFUNC_ERROR == nwritten) {
|
||||
else if(nwritten == CURL_WRITEFUNC_ERROR) {
|
||||
failf(data, "client returned ERROR on write of %zu bytes", blen);
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3616,7 +3616,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
|
|||
pp->response = *Curl_pgrs_now(data); /* timeout relative now */
|
||||
result = getftpresponse(data, &nread, &ftpcode);
|
||||
|
||||
if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) {
|
||||
if(!nread && (result == CURLE_OPERATION_TIMEDOUT)) {
|
||||
failf(data, "control connection looks dead");
|
||||
ftpc->ctl_valid = FALSE; /* mark control connection as bad */
|
||||
connclose(conn, "Timeout or similar in FTP DONE operation"); /* close */
|
||||
|
|
|
|||
|
|
@ -3103,7 +3103,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
|
|||
data->req.upload_chunky = FALSE;
|
||||
|
||||
out:
|
||||
if(CURLE_TOO_LARGE == result)
|
||||
if(result == CURLE_TOO_LARGE)
|
||||
failf(data, "HTTP request too large");
|
||||
|
||||
/* clear userpwd and proxyuserpwd to avoid reusing old credentials
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||
return IF2IP_NOT_FOUND;
|
||||
|
||||
dummy = CURL_SOCKET(AF_INET, SOCK_STREAM, 0);
|
||||
if(CURL_SOCKET_BAD == dummy)
|
||||
if(dummy == CURL_SOCKET_BAD)
|
||||
return IF2IP_NOT_FOUND;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
|
|
|
|||
|
|
@ -725,7 +725,7 @@ MQTT_SUBACK_COMING:
|
|||
rest = sizeof(buffer);
|
||||
result = Curl_xfer_recv(data, buffer, rest, &nread);
|
||||
if(result) {
|
||||
if(CURLE_AGAIN == result) {
|
||||
if(result == CURLE_AGAIN) {
|
||||
infof(data, "EEEE AAAAGAIN");
|
||||
}
|
||||
goto end;
|
||||
|
|
|
|||
|
|
@ -707,7 +707,7 @@ static CURLcode multi_done(struct Curl_easy *data,
|
|||
else
|
||||
result = status;
|
||||
|
||||
if(CURLE_ABORTED_BY_CALLBACK != result) {
|
||||
if(result != CURLE_ABORTED_BY_CALLBACK) {
|
||||
/* avoid this if we already aborted by callback to avoid this calling
|
||||
another callback */
|
||||
int rc = Curl_pgrsDone(data);
|
||||
|
|
@ -1956,7 +1956,7 @@ static CURLMcode state_performing(struct Curl_easy *data,
|
|||
}
|
||||
}
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
else if((CURLE_HTTP2_STREAM == result) &&
|
||||
else if((result == CURLE_HTTP2_STREAM) &&
|
||||
Curl_h2_http_1_1_error(data)) {
|
||||
CURLcode ret = Curl_retry_request(data, &newurl);
|
||||
|
||||
|
|
@ -2135,7 +2135,7 @@ static CURLMcode state_do(struct Curl_easy *data,
|
|||
mresult = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
else if((CURLE_SEND_ERROR == result) &&
|
||||
else if((result == CURLE_SEND_ERROR) &&
|
||||
data->conn->bits.reuse) {
|
||||
/*
|
||||
* In this situation, a connection that we were trying to use may have
|
||||
|
|
@ -2282,7 +2282,7 @@ static CURLMcode state_connect(struct Curl_multi *multi,
|
|||
bool async;
|
||||
CURLMcode mresult = CURLM_OK;
|
||||
CURLcode result = Curl_connect(data, &async, &connected);
|
||||
if(CURLE_NO_CONNECTION_AVAILABLE == result) {
|
||||
if(result == CURLE_NO_CONNECTION_AVAILABLE) {
|
||||
/* There was no connection available. We will go to the pending state and
|
||||
wait for an available connection. */
|
||||
multistate(data, MSTATE_PENDING);
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ static CURLcode rtp_client_write(struct Curl_easy *data, const char *ptr,
|
|||
wrote = writeit((char *)CURL_UNCONST(ptr), 1, len, user_ptr);
|
||||
Curl_set_in_callback(data, FALSE);
|
||||
|
||||
if(CURL_WRITEFUNC_PAUSE == wrote) {
|
||||
if(wrote == CURL_WRITEFUNC_PAUSE) {
|
||||
failf(data, "Cannot pause RTP");
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ CURLcode Curl_blockread_all(struct Curl_cfilter *cf,
|
|||
if(SOCKET_READABLE(cf->conn->sock[cf->sockindex], timeout_ms) <= 0)
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
result = Curl_conn_cf_recv(cf->next, data, buf, blen, &nread);
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
continue;
|
||||
else if(result)
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1082,7 +1082,7 @@ static CURLcode h3_open_stream(struct Curl_cfilter *cf,
|
|||
CURLcode r2 = CURLE_OK;
|
||||
|
||||
r2 = cf_quiche_send_body(cf, data, stream, buf, blen, eos, &nwritten);
|
||||
if(r2 && (CURLE_AGAIN != r2)) { /* real error, fail */
|
||||
if(r2 && (r2 != CURLE_AGAIN)) { /* real error, fail */
|
||||
result = r2;
|
||||
}
|
||||
else if(nwritten > 0) {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static ssize_t gtls_push(void *s, const void *buf, size_t blen)
|
|||
if(result) {
|
||||
/* !checksrc! disable ERRNOVAR 1 */
|
||||
gnutls_transport_set_errno(backend->gtls.session,
|
||||
(CURLE_AGAIN == result) ? EAGAIN : EINVAL);
|
||||
(result == CURLE_AGAIN) ? EAGAIN : EINVAL);
|
||||
return -1;
|
||||
}
|
||||
return (ssize_t)nwritten;
|
||||
|
|
@ -130,7 +130,7 @@ static ssize_t gtls_pull(void *s, void *buf, size_t blen)
|
|||
if(result) {
|
||||
/* !checksrc! disable ERRNOVAR 1 */
|
||||
gnutls_transport_set_errno(backend->gtls.session,
|
||||
(CURLE_AGAIN == result) ? EAGAIN : EINVAL);
|
||||
(result == CURLE_AGAIN) ? EAGAIN : EINVAL);
|
||||
return -1;
|
||||
}
|
||||
else if(nread == 0)
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ static int mbedtls_bio_cf_write(void *bio,
|
|||
result = Curl_conn_cf_send(cf->next, data, buf, blen, FALSE, &nwritten);
|
||||
CURL_TRC_CF(data, cf, "mbedtls_bio_cf_out_write(len=%zu) -> %d, %zu",
|
||||
blen, result, nwritten);
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
return MBEDTLS_ERR_SSL_WANT_WRITE;
|
||||
return result ? -1 : (int)nwritten;
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ static int mbedtls_bio_cf_read(void *bio, unsigned char *buf, size_t blen)
|
|||
result = Curl_conn_cf_recv(cf->next, data, (char *)buf, blen, &nread);
|
||||
CURL_TRC_CF(data, cf, "mbedtls_bio_cf_in_read(len=%zu) -> %d, %zu",
|
||||
blen, result, nread);
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
return MBEDTLS_ERR_SSL_WANT_READ;
|
||||
/* nread is never larger than int here */
|
||||
return result ? -1 : (int)nread;
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ static int ossl_bio_cf_out_write(BIO *bio, const char *buf, int blen)
|
|||
BIO_clear_retry_flags(bio);
|
||||
octx->io_result = result;
|
||||
if(result) {
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
BIO_set_retry_write(bio);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -618,7 +618,7 @@ static int ossl_bio_cf_in_read(BIO *bio, char *buf, int blen)
|
|||
BIO_clear_retry_flags(bio);
|
||||
octx->io_result = result;
|
||||
if(result) {
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
BIO_set_retry_read(bio);
|
||||
}
|
||||
else {
|
||||
|
|
@ -4255,7 +4255,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
|
|||
* (RST connection, etc.), OpenSSL gives no explanation whatsoever and
|
||||
* the SO_ERROR is also lost.
|
||||
*/
|
||||
if(CURLE_SSL_CONNECT_ERROR == result && errdetail == 0) {
|
||||
if(result == CURLE_SSL_CONNECT_ERROR && errdetail == 0) {
|
||||
char extramsg[80] = "";
|
||||
int sockerr = SOCKERRNO;
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static int read_cb(void *userdata, uint8_t *buf, uintptr_t len,
|
|||
if(result) {
|
||||
nread = 0;
|
||||
/* !checksrc! disable ERRNOVAR 4 */
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
ret = EAGAIN;
|
||||
else
|
||||
ret = EINVAL;
|
||||
|
|
@ -130,7 +130,7 @@ static int write_cb(void *userdata, const uint8_t *buf, uintptr_t len,
|
|||
buf, len, FALSE, &nwritten);
|
||||
if(result) {
|
||||
nwritten = 0;
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
ret = EAGAIN;
|
||||
else
|
||||
ret = EINVAL;
|
||||
|
|
@ -355,7 +355,7 @@ static CURLcode cr_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
|
||||
result = cr_flush_out(cf, data, rconn);
|
||||
if(result) {
|
||||
if(CURLE_AGAIN == result) {
|
||||
if(result == CURLE_AGAIN) {
|
||||
/* The TLS bytes may have been partially written, but we fail the
|
||||
* complete send() and remember how much we already added to Rustls. */
|
||||
backend->plain_out_buffered = plainwritten;
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ static int wssl_bio_cf_out_write(WOLFSSL_BIO *bio, const char *buf, int blen)
|
|||
#ifdef USE_FULL_BIO
|
||||
wolfSSL_BIO_clear_retry_flags(bio);
|
||||
#endif
|
||||
if(CURLE_AGAIN == result) {
|
||||
if(result == CURLE_AGAIN) {
|
||||
wolfSSL_BIO_set_retry_write(bio);
|
||||
if(wssl->shutting_down && !wssl->io_send_blocked_len)
|
||||
wssl->io_send_blocked_len = blen;
|
||||
|
|
@ -367,7 +367,7 @@ static int wssl_bio_cf_in_read(WOLFSSL_BIO *bio, char *buf, int blen)
|
|||
#ifdef USE_FULL_BIO
|
||||
wolfSSL_BIO_clear_retry_flags(bio);
|
||||
#endif
|
||||
if(CURLE_AGAIN == result)
|
||||
if(result == CURLE_AGAIN)
|
||||
wolfSSL_BIO_set_retry_read(bio);
|
||||
else if(nread == 0)
|
||||
connssl->peer_closed = TRUE;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static CURLcode test_lib1556(const char *URL)
|
|||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
|
||||
code = curl_easy_perform(curl);
|
||||
if(CURLE_OK != code) {
|
||||
if(code != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "%s:%d curl_easy_perform() failed, "
|
||||
"with code %d (%s)\n",
|
||||
__FILE__, __LINE__, code, curl_easy_strerror(code));
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ static int test_dnsd(int argc, const char **argv)
|
|||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@ static bool mqttd_incoming(curl_socket_t listenfd)
|
|||
|
||||
if(FD_ISSET(sockfd, &fds_read)) {
|
||||
curl_socket_t newfd = accept(sockfd, NULL, NULL);
|
||||
if(CURL_SOCKET_BAD == newfd) {
|
||||
if(newfd == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("accept() failed with error (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -832,7 +832,7 @@ static int test_mqttd(int argc, const char *argv[])
|
|||
|
||||
sock = socket(socket_domain, SOCK_STREAM, 0);
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -842,7 +842,7 @@ static int test_mqttd(int argc, const char *argv[])
|
|||
{
|
||||
/* passive daemon style */
|
||||
sock = sockdaemon(sock, &server_port, NULL, FALSE);
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
goto mqttd_cleanup;
|
||||
}
|
||||
msgsock = CURL_SOCKET_BAD; /* no stream socket yet */
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,7 @@ static int test_rtspd(int argc, const char *argv[])
|
|||
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
#endif
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -1225,7 +1225,7 @@ static int test_rtspd(int argc, const char *argv[])
|
|||
|
||||
if(got_exit_signal)
|
||||
break;
|
||||
if(CURL_SOCKET_BAD == msgsock) {
|
||||
if(msgsock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("MAJOR ERROR, accept() failed with error (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
case PASSIVE_CONNECT:
|
||||
|
||||
sockfd = *sockfdp;
|
||||
if(CURL_SOCKET_BAD == sockfd) {
|
||||
if(sockfd == CURL_SOCKET_BAD) {
|
||||
/* eeek, we are supposedly connected and then this cannot be -1 ! */
|
||||
logmsg("socket is -1! on %s:%d", __FILE__, __LINE__);
|
||||
maxfd = 0; /* stdin */
|
||||
|
|
@ -990,7 +990,7 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
|
||||
sockfd = *sockfdp;
|
||||
/* sockfd turns CURL_SOCKET_BAD when our connection has been closed */
|
||||
if(CURL_SOCKET_BAD != sockfd) {
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
FD_SET(sockfd, &fds_read);
|
||||
maxfd = (int)sockfd;
|
||||
}
|
||||
|
|
@ -1125,7 +1125,7 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
/* there is no stream set up yet, this is an indication that there is a
|
||||
client connecting. */
|
||||
curl_socket_t newfd = accept(sockfd, NULL, NULL);
|
||||
if(CURL_SOCKET_BAD == newfd) {
|
||||
if(newfd == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("accept() failed with error (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -1298,7 +1298,7 @@ static int test_sockfilt(int argc, const char *argv[])
|
|||
|
||||
sock = socket(socket_domain, SOCK_STREAM, 0);
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -1349,7 +1349,7 @@ static int test_sockfilt(int argc, const char *argv[])
|
|||
else {
|
||||
/* passive daemon style */
|
||||
sock = sockdaemon(sock, &server_port, NULL, s_bind_only);
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
write_stdout("FAIL\n", 5);
|
||||
goto sockfilt_cleanup;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ static bool socksd_incoming(curl_socket_t listenfd)
|
|||
|
||||
if((clients < 2) && FD_ISSET(sockfd, &fds_read)) {
|
||||
curl_socket_t newfd = accept(sockfd, NULL, NULL);
|
||||
if(CURL_SOCKET_BAD == newfd) {
|
||||
if(newfd == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("accept() failed with error (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -866,7 +866,7 @@ static int test_socksd(int argc, const char *argv[])
|
|||
|
||||
sock = socket(socket_domain, SOCK_STREAM, 0);
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -876,7 +876,7 @@ static int test_socksd(int argc, const char *argv[])
|
|||
{
|
||||
/* passive daemon style */
|
||||
sock = sockdaemon(sock, &server_port, unix_socket, FALSE);
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
goto socks5_cleanup;
|
||||
}
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
|
|
|
|||
|
|
@ -1266,7 +1266,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
logmsg("about to connect to %s%s%s:%hu", op_br, ipaddr, cl_br, port);
|
||||
|
||||
serverfd = socket(socket_domain, SOCK_STREAM, 0);
|
||||
if(CURL_SOCKET_BAD == serverfd) {
|
||||
if(serverfd == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket for server connection (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -1815,12 +1815,12 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
msgsock = accept(sock, NULL, NULL);
|
||||
|
||||
if(got_exit_signal) {
|
||||
if(CURL_SOCKET_BAD != msgsock)
|
||||
if(msgsock != CURL_SOCKET_BAD)
|
||||
sclose(msgsock);
|
||||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
if(CURL_SOCKET_BAD == msgsock) {
|
||||
if(msgsock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
if(EAGAIN == error || SOCKEWOULDBLOCK == error) {
|
||||
/* nothing to accept */
|
||||
|
|
@ -2146,7 +2146,7 @@ static int test_sws(int argc, const char *argv[])
|
|||
all_sockets[0] = sock;
|
||||
num_sockets = 1;
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -2303,7 +2303,7 @@ static int test_sws(int argc, const char *argv[])
|
|||
|
||||
/* Clear out closed sockets */
|
||||
for(socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) {
|
||||
if(CURL_SOCKET_BAD == all_sockets[socket_idx]) {
|
||||
if(all_sockets[socket_idx] == CURL_SOCKET_BAD) {
|
||||
char *dst = (char *)(all_sockets + socket_idx);
|
||||
char *src = (char *)(all_sockets + socket_idx + 1);
|
||||
char *end = (char *)(all_sockets + num_sockets);
|
||||
|
|
@ -2357,7 +2357,7 @@ static int test_sws(int argc, const char *argv[])
|
|||
msgsock = accept_connection(sock);
|
||||
logmsg("accept_connection %ld returned %ld",
|
||||
(long)sock, (long)msgsock);
|
||||
if(CURL_SOCKET_BAD == msgsock)
|
||||
if(msgsock == CURL_SOCKET_BAD)
|
||||
goto sws_cleanup;
|
||||
if(req->delay)
|
||||
curlx_wait_ms(req->delay);
|
||||
|
|
|
|||
|
|
@ -1120,7 +1120,7 @@ static int test_tftpd(int argc, const char **argv)
|
|||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
if(sock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket (%d) %s",
|
||||
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
|
||||
|
|
@ -1251,7 +1251,7 @@ static int test_tftpd(int argc, const char **argv)
|
|||
#endif
|
||||
from.sa4.sin_family = AF_INET;
|
||||
peer = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if(CURL_SOCKET_BAD == peer) {
|
||||
if(peer == CURL_SOCKET_BAD) {
|
||||
logmsg("socket");
|
||||
result = 2;
|
||||
break;
|
||||
|
|
@ -1266,7 +1266,7 @@ static int test_tftpd(int argc, const char **argv)
|
|||
else {
|
||||
from.sa6.sin6_family = AF_INET6;
|
||||
peer = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
if(CURL_SOCKET_BAD == peer) {
|
||||
if(peer == CURL_SOCKET_BAD) {
|
||||
logmsg("socket");
|
||||
result = 2;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -673,7 +673,7 @@ int bind_unix_socket(curl_socket_t sock, const char *unix_socket,
|
|||
curlx_struct_stat statbuf;
|
||||
/* socket already exists. Perhaps it is stale? */
|
||||
curl_socket_t unixfd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if(CURL_SOCKET_BAD == unixfd) {
|
||||
if(unixfd == CURL_SOCKET_BAD) {
|
||||
logmsg("Failed to create socket at %s (%d) %s", unix_socket,
|
||||
SOCKERRNO, curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ static void check_result(const struct test_case *tc, struct test_result *tr)
|
|||
duration_ms = curlx_timediff_ms(tr->ended, tr->started);
|
||||
curl_mfprintf(stderr, "%d: test case took %dms\n", tc->id, (int)duration_ms);
|
||||
|
||||
if(tr->result != tc->result_exp && CURLE_OPERATION_TIMEDOUT != tr->result) {
|
||||
if(tr->result != tc->result_exp && tr->result != CURLE_OPERATION_TIMEDOUT) {
|
||||
/* on CI we encounter the TIMEOUT result, since images get less CPU
|
||||
* and events are not as sharply timed. */
|
||||
curl_msprintf(msg, "%d: expected result %d but got %d",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue