use vsnprintf() on all platforms, dont special case win32 for vsnprintf and all other...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 29 Aug 2011 09:59:36 +0000 (19:59 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 29 Aug 2011 09:59:36 +0000 (19:59 +1000)
lib/init.c
lib/libnfs.c

index d9f788f99edca3819688d6c9d9582c8ab6b2fe4a..d421797f2c398ecec47fd4f5441042a5526e83a7 100644 (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);
 }
 
index df273fb3d144894705001bbb48a9ddd6599801f4..df8ae802cf6149537c73ced356bff11e8406fa5b 100644 (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);
 }