diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-03-03 12:52:01 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-03-03 12:38:27 -0800 |
commit | c90fd15d335ad452618faf410182ab195193cbc4 (patch) | |
tree | 9bfe8e6f5813c1bb336c1214d4f988b8cba7f57c | |
parent | 25126f64ea049a374fcd724a793328db7c96037f (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.c | 9 |
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); |