Skip to content

Commit

Permalink
try another fix for sendrecv.c
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Dec 20, 2023
1 parent 8e89435 commit accb869
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/examples/sendrecv.c
Expand Up @@ -44,6 +44,14 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms)
FD_ZERO(&outfd);
FD_ZERO(&errfd);

/* Avoid this warning with pre-2020 Cygwin/MSYS2 releases:
* warning: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} may change the sign of the result [-Wsign-conversion]
*/
#if defined(__GNUC__) && defined(__CYGWIN__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#endif
FD_SET(sockfd, &errfd); /* always check for error */

if(for_recv) {
Expand All @@ -52,6 +60,10 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms)
else {
FD_SET(sockfd, &outfd);
}
#if defined(__GNUC__) && defined(__CYGWIN__)
#pragma GCC diagnostic pop
#endif
#endif
/* select() returns the number of signalled sockets or -1 */
res = select((int)sockfd + 1, &infd, &outfd, &errfd, &tv);
Expand Down

0 comments on commit accb869

Please sign in to comment.