use vsnprintf() on all platforms, dont special case win32 for vsnprintf and all other platforms use vasprintf

libnfs-4.0.0-vitalif
Ronnie Sahlberg 2011-08-29 19:59:36 +10:00
parent 2606f9bb3d
commit b85c7de2f7
2 changed files with 3 additions and 13 deletions

View File

@ -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);
}

View File

@ -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);
}