From: Ronnie Sahlberg Date: Mon, 29 Aug 2011 09:59:36 +0000 (+1000) Subject: use vsnprintf() on all platforms, dont special case win32 for vsnprintf and all other... X-Git-Tag: upstream/1.9.6^2~326^2~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b85c7de2f7721e3951ceb68154701fbdb7c4fab5;p=deb_libnfs.git use vsnprintf() on all platforms, dont special case win32 for vsnprintf and all other platforms use vasprintf --- diff --git a/lib/init.c b/lib/init.c index d9f788f..d421797 100644 --- a/lib/init.c +++ b/lib/init.c @@ -90,19 +90,13 @@ void rpc_set_auth(struct rpc_context *rpc, struct 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); -#if defined (WIN32) - str = malloc(1024); - vsnprintf(str, 1024, error_string, ap); -#else - vasprintf(&str, error_string, ap); -#endif - rpc->error_string = str; + rpc->error_string = malloc(1024); + vsnprintf(rpc->error_string, 1024, error_string, ap); va_end(ap); } diff --git a/lib/libnfs.c b/lib/libnfs.c index df273fb..df8ae80 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -2899,16 +2899,12 @@ void nfs_set_error(struct nfs_context *nfs, char *error_string, ...) char *str = NULL; va_start(ap, error_string); -#if defined (WIN32) str = malloc(1024); vsnprintf(str, 1024, error_string, ap); -#else - vasprintf(&str, error_string, ap); -#endif if (nfs->rpc->error_string != NULL) { free(nfs->rpc->error_string); } - fs->rpc->error_string = str; + nfs->rpc->error_string = str; va_end(ap); }