summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/compat.c')
-rw-r--r--libglusterfs/src/compat.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index 76ced628629..85af45f9a48 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -403,8 +403,10 @@ vasprintf (char **result, const char *format, va_list args)
int total_width = strlen (format) + 1;
va_list ap;
- /* this is not really portable but works under Windows */
- memcpy ( &ap, &args, sizeof (va_list));
+ /* vasprintf does not work on Solaris when memcpy is called on va_list pointers.
+ * Replacing it with va_copy which works on Solaris
+ */
+ va_copy (ap, args);
while (*p != '\0')
{
@@ -474,6 +476,9 @@ vasprintf (char **result, const char *format, va_list args)
}
}
}
+
+ va_end (ap);
+
*result = malloc (total_width);
if (*result != NULL)
return vsprintf (*result, format, args);