summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2010-01-29 09:34:26 +0000
committerVincent Torri <vincent.torri@gmail.com>2010-01-29 09:34:26 +0000
commit29db27970c4be4fc08f31100779758a93ae56f8c (patch)
tree40e4ebea50e219fb641ad0414a6ab724731cdb54
parent0aec2b4dcd1ba4918bff2be94fd364183c11d723 (diff)
* src/lib/evil_fcntl.c:
* src/lib/evil_fcntl.h: * src/lib/evil_unistd.c: make pipe() blocking by default and allow fcntl() to set a socket to be non-blocking * src/lib/evil_stdlib.c: fix warning SVN revision: 45698
-rw-r--r--legacy/evil/ChangeLog11
-rw-r--r--legacy/evil/src/lib/evil_fcntl.c14
-rw-r--r--legacy/evil/src/lib/evil_fcntl.h6
-rw-r--r--legacy/evil/src/lib/evil_stdlib.c6
-rw-r--r--legacy/evil/src/lib/evil_unistd.c4
5 files changed, 33 insertions, 8 deletions
diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog
index a2134fe006..97e9e1b3ec 100644
--- a/legacy/evil/ChangeLog
+++ b/legacy/evil/ChangeLog
@@ -1,3 +1,14 @@
12010-01-29 Vincent Torri <doursse at users dot sf dot net>
2
3 * src/lib/evil_fcntl.c:
4 * src/lib/evil_fcntl.h:
5 * src/lib/evil_unistd.c:
6 make pipe() blocking by default and allow fcntl()
7 to set a socket to be non-blocking
8
9 * src/lib/evil_stdlib.c:
10 fix warning
11
12010-01-19 Vincent Torri <doursse at users dot sf dot net> 122010-01-19 Vincent Torri <doursse at users dot sf dot net>
2 13
3 * src/lib/dlfcn/dlfcn.c: 14 * src/lib/dlfcn/dlfcn.c:
diff --git a/legacy/evil/src/lib/evil_fcntl.c b/legacy/evil/src/lib/evil_fcntl.c
index 05f920ba56..e713322bbf 100644
--- a/legacy/evil/src/lib/evil_fcntl.c
+++ b/legacy/evil/src/lib/evil_fcntl.c
@@ -1,4 +1,8 @@
1 1
2#ifdef HAVE_CONFIG_H
3# include "config.h"
4#endif /* HAVE_CONFIG_H */
5
2#include <stdio.h> 6#include <stdio.h>
3 7
4#ifdef _MSC_VER 8#ifdef _MSC_VER
@@ -9,9 +13,7 @@
9# include <sys/locking.h> 13# include <sys/locking.h>
10#endif /* __CEGCC__ */ 14#endif /* __CEGCC__ */
11 15
12#ifdef HAVE_CONFIG_H 16#include <winsock2.h> /* for ioctlsocket */
13# include "config.h"
14#endif /* HAVE_CONFIG_H */
15 17
16#include "Evil.h" 18#include "Evil.h"
17 19
@@ -64,6 +66,12 @@ int fcntl(int fd, int cmd, ...)
64 res = 0; 66 res = 0;
65#endif /* __CEGCC__ || __MINGW32CE__ */ 67#endif /* __CEGCC__ || __MINGW32CE__ */
66 } 68 }
69 if (flag == O_NONBLOCK)
70 {
71 u_long arg = 1;
72 if (ioctlsocket((SOCKET)fd, FIONBIO, &arg) == SOCKET_ERROR)
73 res = 0;
74 }
67 } 75 }
68#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) 76#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
69 else if ((cmd == F_SETLK) || (cmd == F_SETLKW)) 77 else if ((cmd == F_SETLK) || (cmd == F_SETLKW))
diff --git a/legacy/evil/src/lib/evil_fcntl.h b/legacy/evil/src/lib/evil_fcntl.h
index 83cd08d802..e439fd74ec 100644
--- a/legacy/evil/src/lib/evil_fcntl.h
+++ b/legacy/evil/src/lib/evil_fcntl.h
@@ -14,6 +14,12 @@
14# define FD_CLOEXEC 1 14# define FD_CLOEXEC 1
15 15
16/** 16/**
17 * @def O_NONBLOCK
18 * Specifies that the socket is in non-blocking mode.
19 */
20# define O_NONBLOCK 04000
21
22/**
17 * @def F_SETFD 23 * @def F_SETFD
18 * Specifies that fcntl() should set the file descriptor flags 24 * Specifies that fcntl() should set the file descriptor flags
19 * associated with the filedes argument. 25 * associated with the filedes argument.
diff --git a/legacy/evil/src/lib/evil_stdlib.c b/legacy/evil/src/lib/evil_stdlib.c
index 325763bf99..69e1cbdbd2 100644
--- a/legacy/evil/src/lib/evil_stdlib.c
+++ b/legacy/evil/src/lib/evil_stdlib.c
@@ -322,7 +322,7 @@ mkstemp(char *__template)
322 322
323#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) 323#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
324 fd = _open(__template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE); 324 fd = _open(__template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
325#else /* __CEGCC__ || __MINGW32CE__ */ 325#else /* _WIN32_WCE */
326 { 326 {
327 FILE *f; 327 FILE *f;
328 wchar_t *wtemplate; 328 wchar_t *wtemplate;
@@ -339,9 +339,9 @@ mkstemp(char *__template)
339#endif /* HAVE_ERRNO_H */ 339#endif /* HAVE_ERRNO_H */
340 return -1; 340 return -1;
341 } 341 }
342 fd = _fileno(f); 342 fd = (int)_fileno(f);
343 } 343 }
344#endif /* __CEGCC__ || __MINGW32CE__ */ 344#endif /* _WIN32_WCE */
345 if (fd >= 0) 345 if (fd >= 0)
346 return fd; 346 return fd;
347 347
diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c
index e22dfabf02..32c233560e 100644
--- a/legacy/evil/src/lib/evil_unistd.c
+++ b/legacy/evil/src/lib/evil_unistd.c
@@ -382,11 +382,11 @@ evil_pipe(int *fds)
382 if (!FD_ISSET (socket1, &write_set)) 382 if (!FD_ISSET (socket1, &write_set))
383 goto out2; 383 goto out2;
384 384
385 arg = 1; 385 arg = 0;
386 if (ioctlsocket (socket1, FIONBIO, &arg) == SOCKET_ERROR) 386 if (ioctlsocket (socket1, FIONBIO, &arg) == SOCKET_ERROR)
387 goto out2; 387 goto out2;
388 388
389 arg = 1; 389 arg = 0;
390 if (ioctlsocket (socket2, FIONBIO, &arg) == SOCKET_ERROR) 390 if (ioctlsocket (socket2, FIONBIO, &arg) == SOCKET_ERROR)
391 goto out2; 391 goto out2;
392 392