From: Andre Noll Date: Wed, 29 Apr 2009 19:26:00 +0000 (+0200) Subject: [client] Dynamically allocate output buffer. X-Git-Tag: v0.3.5~61^2~4 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=7cbd55c6c3c18634e939b1ca0746ef4768fdfe8a [client] Dynamically allocate output buffer. This should simplify subsequent patches that allow variable-sized output buffers for filters/receivers. --- diff --git a/client.h b/client.h index a7a3289b..c6d5c75d 100644 --- a/client.h +++ b/client.h @@ -58,7 +58,7 @@ struct client_task { /** the client task structure */ struct task task; /** the buffer used for handshake and receiving */ - char buf[CLIENT_BUFSIZE]; + char *buf; /** number of bytes loaded in \p buf */ size_t loaded; /** non-zero if the pre_select hook added \p fd to the read fd set */ diff --git a/client_common.c b/client_common.c index c1e23f7a..5bce7fb4 100644 --- a/client_common.c +++ b/client_common.c @@ -64,6 +64,7 @@ void client_close(struct client_task *ct) disable_crypt(ct->fd); close(ct->fd); } + free(ct->buf); free(ct->user); free(ct->config_file); free(ct->key_file); @@ -327,6 +328,7 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr, int ret; struct client_task *ct = para_calloc(sizeof(struct client_task)); + ct->buf = para_malloc(CLIENT_BUFSIZE); *ct_ptr = ct; ct->fd = -1; ret = -E_CLIENT_SYNTAX;