mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
don't shadow 'socket'
This commit is contained in:
parent
80a06403e4
commit
5eee801d06
@ -98,7 +98,7 @@ int Curl_ourerrno(void)
|
|||||||
* Set the socket to either blocking or non-blocking mode.
|
* Set the socket to either blocking or non-blocking mode.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int Curl_nonblock(int socket, /* operate on this */
|
int Curl_nonblock(int sockfd, /* operate on this */
|
||||||
int nonblock /* TRUE or FALSE */)
|
int nonblock /* TRUE or FALSE */)
|
||||||
{
|
{
|
||||||
#undef SETBLOCK
|
#undef SETBLOCK
|
||||||
@ -106,11 +106,11 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
/* most recent unix versions */
|
/* most recent unix versions */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = fcntl(socket, F_GETFL, 0);
|
flags = fcntl(sockfd, F_GETFL, 0);
|
||||||
if (TRUE == nonblock)
|
if (TRUE == nonblock)
|
||||||
return fcntl(socket, F_SETFL, flags | O_NONBLOCK);
|
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
|
||||||
else
|
else
|
||||||
return fcntl(socket, F_SETFL, flags & (~O_NONBLOCK));
|
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
|
||||||
#define SETBLOCK 1
|
#define SETBLOCK 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = nonblock;
|
flags = nonblock;
|
||||||
return ioctl(socket, FIONBIO, &flags);
|
return ioctl(sockfd, FIONBIO, &flags);
|
||||||
#define SETBLOCK 2
|
#define SETBLOCK 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -127,20 +127,20 @@ int Curl_nonblock(int socket, /* operate on this */
|
|||||||
/* Windows? */
|
/* Windows? */
|
||||||
int flags;
|
int flags;
|
||||||
flags = nonblock;
|
flags = nonblock;
|
||||||
return ioctlsocket(socket, FIONBIO, &flags);
|
return ioctlsocket(sockfd, FIONBIO, &flags);
|
||||||
#define SETBLOCK 3
|
#define SETBLOCK 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_IOCTLSOCKET_CASE
|
#ifdef HAVE_IOCTLSOCKET_CASE
|
||||||
/* presumably for Amiga */
|
/* presumably for Amiga */
|
||||||
return IoctlSocket(socket, FIONBIO, (long)nonblock);
|
return IoctlSocket(sockfd, FIONBIO, (long)nonblock);
|
||||||
#define SETBLOCK 4
|
#define SETBLOCK 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SO_NONBLOCK
|
#ifdef HAVE_SO_NONBLOCK
|
||||||
/* BeOS */
|
/* BeOS */
|
||||||
long b = nonblock ? 1 : 0;
|
long b = nonblock ? 1 : 0;
|
||||||
return setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
|
return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
|
||||||
#define SETBLOCK 5
|
#define SETBLOCK 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user