* src/lib/evil_fcntl.c:

verify that the data passed to fcntl() is really a socket
	and fix ioctlsocket() returned value check.
	* src/bin/Makefile.am:
	* src/bin/evil_suite.c:
	add unit test for pipe().



SVN revision: 45736
This commit is contained in:
Vincent Torri 2010-01-30 19:55:45 +00:00
parent 8498d88bc6
commit 65d13f2085
4 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2010-01-30 Vincent Torri <doursse at users dot sf dot net>
* src/lib/evil_fcntl.c:
verify that the data passed to fcntl() is really a socket
and fix ioctlsocket() returned value check.
* src/bin/Makefile.am:
* src/bin/evil_suite.c:
add unit test for pipe().
2010-01-30 Vincent Torri <doursse at users dot sf dot net>
* src/lib/Evil.h:

View File

@ -20,6 +20,7 @@ evil_test_gettimeofday.c \
evil_test_link.c \
evil_test_memcpy.c \
evil_test_mkstemp.c \
evil_test_pipe.c \
evil_test_realpath.c
if EVIL_HAVE_WINCE

View File

@ -17,6 +17,7 @@
#include "evil_test_link.h"
#include "evil_test_memcpy.h"
#include "evil_test_mkstemp.h"
#include "evil_test_pipe.h"
#include "evil_test_realpath.h"
@ -182,6 +183,7 @@ main()
{ "gettimeofday", test_gettimeofday },
{ "link ", test_link },
{ "mkstemp ", test_mkstemp },
{ "pipe ", test_pipe },
{ "realpath ", test_realpath },
/* { "memcpy ", test_memcpy }, */
{ NULL, NULL },

View File

@ -75,8 +75,17 @@ int fcntl(int fd, int cmd, ...)
if (flag == O_NONBLOCK)
{
u_long arg = 1;
if (ioctlsocket((SOCKET)fd, FIONBIO, &arg) == SOCKET_ERROR)
res = 0;
int type;
int len;
int ret;
len = (int)sizeof(int);
ret = getsockopt((SOCKET)fd, SOL_SOCKET, SO_TYPE, (char *)&type, &len);
if (!ret && (type == SOCK_STREAM))
{
if (!ioctlsocket((SOCKET)fd, FIONBIO, &arg) == SOCKET_ERROR)
res = 0;
}
}
}
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )