X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Finit.c;h=7ef329298afb136f337d4a1d5cea2adbc4aadda5;hb=ea98629aef9428ca270a76b77e8de49e523be0e4;hp=536a56c605ac75111b10ba0e142d7690c1b41649;hpb=eecdc4f3cd5c464ae02823a823993e720664e465;p=deb_libnfs.git diff --git a/lib/init.c b/lib/init.c index 536a56c..7ef3292 100644 --- a/lib/init.c +++ b/lib/init.c @@ -1,10 +1,7 @@ /* Copyright (C) 2010 by Ronnie Sahlberg - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -43,7 +40,7 @@ struct rpc_context *rpc_init_context(void) if (rpc == NULL) { return NULL; } - bzero(rpc, sizeof(struct rpc_context)); + memset(rpc, 0, sizeof(struct rpc_context)); rpc->encodebuflen = 65536; rpc->encodebuf = malloc(rpc->encodebuflen); @@ -86,21 +83,20 @@ void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth) if (rpc->auth != NULL) { auth_destroy(rpc->auth); } - rpc->auth = auth; + rpc->auth = (AUTH *)auth; } void rpc_set_error(struct rpc_context *rpc, char *error_string, ...) { va_list ap; - char *str; if (rpc->error_string != NULL) { free(rpc->error_string); } va_start(ap, error_string); - vasprintf(&str, error_string, ap); - rpc->error_string = str; + rpc->error_string = malloc(1024); + vsnprintf(rpc->error_string, 1024, error_string, ap); va_end(ap); }