fixed hypthetical bug, where the client address is not correctly retrieved by accept()

Mon, 21 Mar 2016 20:35:58 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 21 Mar 2016 20:35:58 +0100
changeset 56
11b57a15d11a
parent 55
54ea19938d57
child 57
498d92449d6d

fixed hypthetical bug, where the client address is not correctly retrieved by accept()

src/network.c file | annotate | diff | comparison | revisions
src/terminal-chess.h file | annotate | diff | comparison | revisions
--- a/src/network.c	Fri Feb 26 11:55:42 2016 +0100
+++ b/src/network.c	Mon Mar 21 20:35:58 2016 +0100
@@ -74,8 +74,9 @@
 
 int net_listen(Server *server) {
     listen(server->fd, 1);
-    Client* client = calloc(1, sizeof(Client));
+    Client* client = malloc(sizeof(Client));
     client->fd = -1;
+    client->address_len = sizeof(client->address);
     server->client = client;
     
     client->fd = accept(server->fd,
--- a/src/terminal-chess.h	Fri Feb 26 11:55:42 2016 +0100
+++ b/src/terminal-chess.h	Mon Mar 21 20:35:58 2016 +0100
@@ -36,7 +36,7 @@
 #ifndef TERMINAL_CHESS_H
 #define	TERMINAL_CHESS_H
 
-#define PROGRAM_VERSION "0.9-r55"
+#define PROGRAM_VERSION "0.9-r56"
 
 #ifdef	__cplusplus
 extern "C" {

mercurial