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
     1.1 --- a/src/network.c	Fri Feb 26 11:55:42 2016 +0100
     1.2 +++ b/src/network.c	Mon Mar 21 20:35:58 2016 +0100
     1.3 @@ -74,8 +74,9 @@
     1.4  
     1.5  int net_listen(Server *server) {
     1.6      listen(server->fd, 1);
     1.7 -    Client* client = calloc(1, sizeof(Client));
     1.8 +    Client* client = malloc(sizeof(Client));
     1.9      client->fd = -1;
    1.10 +    client->address_len = sizeof(client->address);
    1.11      server->client = client;
    1.12      
    1.13      client->fd = accept(server->fd,
     2.1 --- a/src/terminal-chess.h	Fri Feb 26 11:55:42 2016 +0100
     2.2 +++ b/src/terminal-chess.h	Mon Mar 21 20:35:58 2016 +0100
     2.3 @@ -36,7 +36,7 @@
     2.4  #ifndef TERMINAL_CHESS_H
     2.5  #define	TERMINAL_CHESS_H
     2.6  
     2.7 -#define PROGRAM_VERSION "0.9-r55"
     2.8 +#define PROGRAM_VERSION "0.9-r56"
     2.9  
    2.10  #ifdef	__cplusplus
    2.11  extern "C" {

mercurial