X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/b910d991f0cace9bf6f31ca6430836a99c6d4456..f0e796d9a12d5f78fb89f312f138c1a0bb6f0141:/doc/bugs/build_in_opensolaris.mdwn?ds=sidebyside diff --git a/doc/bugs/build_in_opensolaris.mdwn b/doc/bugs/build_in_opensolaris.mdwn index 4e5b92d2d..faf5d9980 100644 --- a/doc/bugs/build_in_opensolaris.mdwn +++ b/doc/bugs/build_in_opensolaris.mdwn @@ -31,3 +31,44 @@ Thanks, Joey et al., for a really cool tool. >> Of the possible patches to make this more portable, I'd generally prefer >> one that uses portable functions (safely), rather than one that includes >> an asprintf implementation in ikiwiki. --[[Joey]] + +> I got ikiwiki working (sort of) on OpenSolaris today. I ran into this problem too, and wrote a version of asprintf() from scratch which uses more portable APIs: + + + #include <stdarg.h> + + int + asprintf(char **string_ptr, const char *format, ...) + { + va_list arg; + char *str; + int size; + int rv; + + va_start(arg, format); + size = vsnprintf(NULL, 0, format, arg); + size++; + va_start(arg, format); + str = malloc(size); + if (str == NULL) { + va_end(arg); + /* + * Strictly speaking, GNU asprintf doesn't do this, + * but the caller isn't checking the return value. + */ + fprintf(stderr, "failed to allocate memory\\n"); + exit(1); + } + rv = vsnprintf(str, size, format, arg); + va_end(arg); + + *string_ptr = str; + return (rv); + } + + + +> I added this after the rest of the #include's in Wrapper.pm, and it seems to work. --Blake + +>> I have this marked [[bugs/done]] already, because I changed it in svn to +>> not use asprintf --[[Joey]]