fix socket.c
This commit is contained in:
		@@ -21,6 +21,8 @@
 | 
			
		||||
	#include <arpa/inet.h>
 | 
			
		||||
	#include <netinet/in.h>
 | 
			
		||||
	#include <fcntl.h>
 | 
			
		||||
	#include <errno.h>
 | 
			
		||||
	#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
	#define IS_SOCKET_ERROR(a)	((a)<0)
 | 
			
		||||
	typedef int				socket_t;
 | 
			
		||||
@@ -99,10 +101,10 @@ static int socket_connect (socket_t * sock, const struct sockaddr *saddr, sockle
 | 
			
		||||
{
 | 
			
		||||
	while ( 1 )
 | 
			
		||||
	{
 | 
			
		||||
	    if ( connect (*sock, saddr, len) < 0 )
 | 
			
		||||
	    {
 | 
			
		||||
	    	if ( socket_error() == EINTR )
 | 
			
		||||
	    		continue;
 | 
			
		||||
		if ( connect (*sock, saddr, len) < 0 )
 | 
			
		||||
		{
 | 
			
		||||
			if ( socket_error() == EINTR )
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			if ( socket_error() != EINPROGRESS && socket_error() != EWOULDBLOCK )
 | 
			
		||||
				return 1;
 | 
			
		||||
@@ -117,8 +119,8 @@ static int socket_accept (socket_t * sock, socket_t * newsock, struct sockaddr *
 | 
			
		||||
{
 | 
			
		||||
	while ( IS_SOCKET_ERROR(*newsock = accept (*sock, saddr, len)) )
 | 
			
		||||
	{
 | 
			
		||||
    	if ( socket_error() == EINTR )
 | 
			
		||||
    		continue;
 | 
			
		||||
		if ( socket_error() == EINTR )
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user