Fix for Netbeans on MS-Windows not compiling.
This commit is contained in:
@ -34,7 +34,7 @@
|
|||||||
# endif
|
# endif
|
||||||
/* WinSock API is separated from C API, thus we can't use read(), write(),
|
/* WinSock API is separated from C API, thus we can't use read(), write(),
|
||||||
* errno... */
|
* errno... */
|
||||||
# define sock_errno WSAGetLastError()
|
# define SOCK_ERRNO errno = WSAGetLastError()
|
||||||
# undef ECONNREFUSED
|
# undef ECONNREFUSED
|
||||||
# define ECONNREFUSED WSAECONNREFUSED
|
# define ECONNREFUSED WSAECONNREFUSED
|
||||||
# ifdef EINTR
|
# ifdef EINTR
|
||||||
@ -57,7 +57,7 @@
|
|||||||
# ifdef HAVE_LIBGEN_H
|
# ifdef HAVE_LIBGEN_H
|
||||||
# include <libgen.h>
|
# include <libgen.h>
|
||||||
# endif
|
# endif
|
||||||
# define sock_errno errno
|
# define SOCK_ERRNO
|
||||||
# define sock_write(sd, buf, len) write(sd, buf, len)
|
# define sock_write(sd, buf, len) write(sd, buf, len)
|
||||||
# define sock_read(sd, buf, len) read(sd, buf, len)
|
# define sock_read(sd, buf, len) read(sd, buf, len)
|
||||||
# define sock_close(sd) close(sd)
|
# define sock_close(sd) close(sd)
|
||||||
@ -333,13 +333,15 @@ netbeans_connect(char *params, int abort)
|
|||||||
/* Connect to server */
|
/* Connect to server */
|
||||||
if (connect(sd, (struct sockaddr *)&server, sizeof(server)))
|
if (connect(sd, (struct sockaddr *)&server, sizeof(server)))
|
||||||
{
|
{
|
||||||
nbdebug(("netbeans_connect: Connect failed with errno %d\n", sock_errno));
|
SOCK_ERRNO;
|
||||||
if (sock_errno == ECONNREFUSED)
|
nbdebug(("netbeans_connect: Connect failed with errno %d\n", errno));
|
||||||
|
if (errno == ECONNREFUSED)
|
||||||
{
|
{
|
||||||
sock_close(sd);
|
sock_close(sd);
|
||||||
#ifdef INET_SOCKETS
|
#ifdef INET_SOCKETS
|
||||||
if ((sd = (NBSOCK)socket(AF_INET, SOCK_STREAM, 0)) == (NBSOCK)-1)
|
if ((sd = (NBSOCK)socket(AF_INET, SOCK_STREAM, 0)) == (NBSOCK)-1)
|
||||||
{
|
{
|
||||||
|
SOCK_ERRNO;
|
||||||
nbdebug(("socket()#2 in netbeans_connect()\n"));
|
nbdebug(("socket()#2 in netbeans_connect()\n"));
|
||||||
PERROR("socket()#2 in netbeans_connect()");
|
PERROR("socket()#2 in netbeans_connect()");
|
||||||
goto theend;
|
goto theend;
|
||||||
@ -347,6 +349,7 @@ netbeans_connect(char *params, int abort)
|
|||||||
#else
|
#else
|
||||||
if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
|
if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
|
||||||
{
|
{
|
||||||
|
SOCK_ERRNO;
|
||||||
nbdebug(("socket()#2 in netbeans_connect()\n"));
|
nbdebug(("socket()#2 in netbeans_connect()\n"));
|
||||||
PERROR("socket()#2 in netbeans_connect()");
|
PERROR("socket()#2 in netbeans_connect()");
|
||||||
goto theend;
|
goto theend;
|
||||||
@ -356,8 +359,10 @@ netbeans_connect(char *params, int abort)
|
|||||||
{
|
{
|
||||||
int retries = 36;
|
int retries = 36;
|
||||||
int success = FALSE;
|
int success = FALSE;
|
||||||
while (retries--
|
|
||||||
&& ((sock_errno == ECONNREFUSED) || (sock_errno == EINTR)))
|
SOCK_ERRNO;
|
||||||
|
while (retries-- && ((errno == ECONNREFUSED)
|
||||||
|
|| (errno == EINTR)))
|
||||||
{
|
{
|
||||||
nbdebug(("retrying...\n"));
|
nbdebug(("retrying...\n"));
|
||||||
sleep(5);
|
sleep(5);
|
||||||
@ -366,16 +371,17 @@ netbeans_connect(char *params, int abort)
|
|||||||
ui_breakcheck();
|
ui_breakcheck();
|
||||||
if (got_int)
|
if (got_int)
|
||||||
{
|
{
|
||||||
sock_errno = EINTR;
|
errno = EINTR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (connect(sd, (struct sockaddr *)&server,
|
if (connect(sd, (struct sockaddr *)&server,
|
||||||
sizeof(server)) == 0)
|
sizeof(server)) == 0)
|
||||||
{
|
{
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
SOCK_ERRNO;
|
||||||
}
|
}
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
@ -387,7 +393,6 @@ netbeans_connect(char *params, int abort)
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user