From c90fd15d335ad452618faf410182ab195193cbc4 Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Wed, 3 Mar 2010 12:52:01 +0000 Subject: libglusterfs: Copy va_list types using va_copy instead of memcpy. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Anand V. Avati BUG: 621 (3.0.2 GlusterFS fails on Solaris 10) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=621 --- libglusterfs/src/compat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libglusterfs/src/compat.c') 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); -- cgit