Hi, We encountered crashes on solaris-10/amd64 platform, the root cause seems to be that the asprintf implementation in libdbi uses memcpy() to duplicate the argument array.
This is not portable. The attached patch fixes it. Please apply. diff -u -r1.4 asprintf.c --- src/asprintf.c 28 Jul 2005 19:40:48 -0000 1.4 +++ src/asprintf.c 4 Oct 2008 17:30:35 -0000 @@ -14,7 +14,7 @@ #ifndef HAVE_VASPRINTF -int int_vasprintf(char **result, const char *format, va_list *args) +int vasprintf(char **result, const char *format, va_list args) { const char *p = format; /* Add one to make sure that it is never zero, which might cause malloc @@ -22,13 +22,13 @@ int total_width = strlen(format) + 1; va_list ap; - memcpy((char*) &ap, (char*) args, sizeof(va_list)); + va_copy(ap, args); while (*p != '\0') { if (*p++ == '%') { while (strchr ("-+ #0", *p)) { - ++p; - } + ++p; + } if (*p == '*') { ++p; @@ -46,8 +46,8 @@ total_width += abs(va_arg(ap, int)); } else { - total_width += (unsigned long) strtol(p, (char**) &p, 10); - } + total_width += (unsigned long) strtol(p, (char**) &p, 10); + } } while (strchr ("hlL", *p)) { @@ -89,20 +89,15 @@ } *result = malloc(total_width); - + va_end(ap); if (*result != NULL) { - return vsprintf(*result, format, *args); + return vsprintf(*result, format, args); } else { return 0; } } -int vasprintf(char **result, const char *format, va_list args) -{ - return int_vasprintf(result, format, &args); -} - #endif /* !HAVE_VASPRINTF */ #ifndef HAVE_ASPRINTF Index: src/dbi_main.c =================================================================== RCS file: /cvsroot/libdbi/libdbi/src/dbi_main.c,v retrieving revision 1.85 diff -u -r1.85 dbi_main.c --- src/dbi_main.c 27 May 2008 10:52:12 -0000 1.85 +++ src/dbi_main.c 4 Oct 2008 17:30:36 -0000 @@ -109,7 +109,6 @@ /* declarations of optional external functions */ #ifndef HAVE_VASPRINTF -int int_vasprintf(char **result, const char *format, va_list *args); int vasprintf(char **result, const char *format, va_list args); #endif #ifndef HAVE_ASPRINTF -- Bazsi ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libdbi-drivers-devel mailing list Libdbi-drivers-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel