X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Finit.c;h=36d4880006d9f244b804fdf0a8b2631c2a220924;hb=54bafab240be2a172ce8075fd25497a149bdf77c;hp=df3c2aa2bd90cc25a7302907428c362648f7b85e;hpb=9126c9c0366028cb799978d145fd361c6635b5f4;p=deb_libnfs.git diff --git a/lib/init.c b/lib/init.c index df3c2aa..36d4880 100644 --- a/lib/init.c +++ b/lib/init.c @@ -57,7 +57,9 @@ struct rpc_context *rpc_init_context(void) memset(rpc, 0, sizeof(struct rpc_context)); rpc->magic = RPC_CONTEXT_MAGIC; - rpc->encodebuflen = 65536; + + /* Allow 1M of data (for writes) and some */ + rpc->encodebuflen = 1024 * 1024 + 4096; rpc->encodebuf = malloc(rpc->encodebuflen); if (rpc->encodebuf == NULL) { free(rpc); @@ -74,7 +76,7 @@ struct rpc_context *rpc_init_context(void) salt += 0x01000000; rpc->fd = -1; rpc->tcp_syncnt = RPC_PARAM_UNDEFINED; -#ifdef WIN32 +#if defined(WIN32) || defined(ANDROID) rpc->uid = 65534; rpc->gid = 65534; #else @@ -130,16 +132,18 @@ void rpc_set_gid(struct rpc_context *rpc, int gid) { void rpc_set_error(struct rpc_context *rpc, char *error_string, ...) { va_list ap; + char *old_error_string = rpc->error_string; assert(rpc->magic == RPC_CONTEXT_MAGIC); - if (rpc->error_string != NULL) { - free(rpc->error_string); - } va_start(ap, error_string); rpc->error_string = malloc(1024); vsnprintf(rpc->error_string, 1024, error_string, ap); va_end(ap); + + if (old_error_string != NULL) { + free(old_error_string); + } } char *rpc_get_error(struct rpc_context *rpc)