]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
[client] Dynamically allocate output buffer.
authorAndre Noll <maan@systemlinux.org>
Wed, 29 Apr 2009 19:26:00 +0000 (21:26 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 29 Apr 2009 19:26:00 +0000 (21:26 +0200)
This should simplify subsequent patches that allow variable-sized
output buffers for filters/receivers.

client.h
client_common.c

index a7a3289b12b3c6acded3b11cd2ecf40d4f69fa6b..c6d5c75d1ebf1e70a7dbeafa5ca10f60a2e00592 100644 (file)
--- 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 */
index c1e23f7a53d228bde4b3c26149432a71029327ad..5bce7fb4c21d7a9dfaa6e7e0a220fe57bc7ad8e0 100644 (file)
@@ -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;