summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-03-03 12:51:21 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-03 12:38:31 -0800
commite9f24280bbaa0567f3807b9f0c2ce6545296b8a3 (patch)
tree6e9e3be11f57d8d2074dacc287c0ac9c8df27694
parent8150d6bb9041f7e1b61370aebe14181f368d679f (diff)
libglusterfs: Copy va_list types using va_copy instead of memcpy.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 621 (3.0.2 GlusterFS fails on Solaris 10) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=621
-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);