]> sipb.mit.edu Git - ikiwiki.git/commitdiff
web commit by http://blakej.myopenid.com/
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 11 Jul 2007 00:55:30 +0000 (00:55 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 11 Jul 2007 00:55:30 +0000 (00:55 +0000)
doc/bugs/build_in_opensolaris.mdwn

index 4b738ccffc433feb4c30a11425892f1ce1cbc6f6..7c870afcea0e350529dc4bc0ff4c4ca8eb946f2f 100644 (file)
@@ -32,4 +32,42 @@ Thanks, Joey et al., for a really cool tool.
 >> 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:
+<code>
+    #include &lt;stdarg.h&gt;
+    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);
+    }
+
+</code>
+
+> I added this after the rest of the #include's in Wrapper.pm, and it seems to work. --Blake
+
 [[bugs/done]]