Win32: add workaround for lack of vasprintf() and use vsnprintf() on windows on a...
[deb_libnfs.git] / lib / libnfs.c
index 8a0adba4614ca7df31ca787e9aa254a5b465008e..df273fb3d144894705001bbb48a9ddd6599801f4 100644 (file)
@@ -2899,11 +2899,16 @@ void nfs_set_error(struct nfs_context *nfs, char *error_string, ...)
        char *str = NULL;
 
         va_start(ap, error_string);
-       //      vasprintf(&str, error_string, ap);
-       //      if (nfs->rpc->error_string != NULL) {
-       //      free(nfs->rpc->error_string);
-       //}
-       //nfs->rpc->error_string = str;
+#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;
         va_end(ap);
 }