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
This commit is contained in:
Pavan Sondur 2010-03-03 12:52:01 +00:00 committed by Anand V. Avati
parent 25126f64ea
commit c90fd15d33

View File

@ -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);