aboutsummaryrefslogtreecommitdiff
path: root/src/unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix.c')
-rw-r--r--src/unix.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/unix.c b/src/unix.c
index 0fc08bd..511a6bb 100644
--- a/src/unix.c
+++ b/src/unix.c
@@ -1,8 +1,6 @@
1/*=========================================================================*\ 1/*=========================================================================*\
2* Network compatibilization module 2* Network compatibilization module
3\*=========================================================================*/ 3\*=========================================================================*/
4#include <string.h>
5
6#include <lua.h> 4#include <lua.h>
7#include <lauxlib.h> 5#include <lauxlib.h>
8 6
@@ -17,14 +15,14 @@ static cchar *try_setbooloption(lua_State *L, COMPAT_FD sock, int name);
17/*=========================================================================*\ 15/*=========================================================================*\
18* Exported functions. 16* Exported functions.
19\*=========================================================================*/ 17\*=========================================================================*/
20void compat_open(lua_State *L) 18int compat_open(lua_State *L)
21{ 19{
22 /* Instals a handler to ignore sigpipe. This function is not 20 /* Instals a handler to ignore sigpipe. */
23 needed on the WinSock2, since it's sockets don't raise signals. */
24 struct sigaction new; 21 struct sigaction new;
25 memset(&new, 0, sizeof(new)); 22 memset(&new, 0, sizeof(new));
26 new.sa_handler = SIG_IGN; 23 new.sa_handler = SIG_IGN;
27 sigaction(SIGPIPE, &new, NULL); 24 sigaction(SIGPIPE, &new, NULL);
25 return 1;
28} 26}
29 27
30COMPAT_FD compat_accept(COMPAT_FD s, struct sockaddr *addr, 28COMPAT_FD compat_accept(COMPAT_FD s, struct sockaddr *addr,
@@ -59,7 +57,7 @@ int compat_send(COMPAT_FD c, cchar *data, size_t count, size_t *sent,
59 err = PRIV_CLOSED; 57 err = PRIV_CLOSED;
60#ifdef __CYGWIN__ 58#ifdef __CYGWIN__
61 /* this is for CYGWIN, which is like Unix but has Win32 bugs */ 59 /* this is for CYGWIN, which is like Unix but has Win32 bugs */
62 if (sent < 0 && errno == EWOULDBLOCK) err = PRIV_DONE; 60 if (errno == EWOULDBLOCK) err = PRIV_DONE;
63#endif 61#endif
64 *sent = 0; 62 *sent = 0;
65 } else { 63 } else {