aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luasocket.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/luasocket.c b/src/luasocket.c
index ab44490..2216b90 100644
--- a/src/luasocket.c
+++ b/src/luasocket.c
@@ -325,7 +325,7 @@ static int net_accept(lua_State *L)
325 int client_tag, server_tag; 325 int client_tag, server_tag;
326 p_sock server; 326 p_sock server;
327 int client_sock = -1; 327 int client_sock = -1;
328 unsigned int client_len = sizeof(client_addr); 328 size_t client_len = sizeof(client_addr);
329 p_sock client; 329 p_sock client;
330 pop_tags(L, &client_tag, &server_tag); 330 pop_tags(L, &client_tag, &server_tag);
331 server = check_server(L, 1, server_tag); 331 server = check_server(L, 1, server_tag);
@@ -364,7 +364,7 @@ static int net_bind(lua_State *L)
364 unsigned short port = (unsigned short) luaL_check_number(L, 2); 364 unsigned short port = (unsigned short) luaL_check_number(L, 2);
365 unsigned int backlog = (unsigned int) luaL_opt_number(L, 3, 1.0); 365 unsigned int backlog = (unsigned int) luaL_opt_number(L, 3, 1.0);
366 struct sockaddr_in server; 366 struct sockaddr_in server;
367 int server_size = sizeof(server); 367 size_t server_size = sizeof(server);
368 int client_tag, server_tag; 368 int client_tag, server_tag;
369 p_sock sock = create_tcpsock(); 369 p_sock sock = create_tcpsock();
370 pop_tags(L, &client_tag, &server_tag); 370 pop_tags(L, &client_tag, &server_tag);
@@ -687,20 +687,10 @@ static int sock_gc(lua_State *L)
687static void handle_sigpipe(void); 687static void handle_sigpipe(void);
688static void handle_sigpipe(void) 688static void handle_sigpipe(void)
689{ 689{
690 struct sigaction old, new; 690 struct sigaction new;
691 bzero(&new, sizeof new); 691 memset(&new, 0, sizeof(new));
692 new.sa_handler = SIG_IGN; 692 new.sa_handler = SIG_IGN;
693 sigaction(SIGPIPE, &new, &old); 693 sigaction(SIGPIPE, &new, NULL);
694 /* test if the signal had been before, and restore it if so */
695 if (old.sa_handler != SIG_DFL) {
696#ifdef _DEBUG
697/* this is a somewhat dangerous situation. we can only hope the
698** installed signal handler understands that this signal can be
699** raised by a socket operation */
700printf("SIGPIPE ALREADY REDEFINED!!!\n");
701#endif
702 sigaction(SIGPIPE, &old, NULL);
703 }
704} 694}
705#endif 695#endif
706 696
@@ -928,7 +918,7 @@ static int send_raw(p_sock sock, const char *data, int wanted,
928 return total; 918 return total;
929 } 919 }
930#ifdef _DEBUG_BLOCK 920#ifdef _DEBUG_BLOCK
931printf("luasocket: sent %d bytes, %dms elapsed\n", put, time_since(start)); 921printf("luasocket: sent %d, wanted %d, %dms elapsed\n", put, wanted, time_since(start));
932#endif 922#endif
933 wanted -= put; 923 wanted -= put;
934 data += put; 924 data += put;