]> git.meshlink.io Git - catta/blobdiff - avahi-common/malloc.c
use /bin/sh
[catta] / avahi-common / malloc.c
index 9b0e22e12b70ae7aa88065a75c2a2ef59232efae..52e0962df25a25607f221435d2f16593b5fd8222 100644 (file)
@@ -192,7 +192,7 @@ void avahi_set_allocator(const AvahiAllocator *a) {
 }
 
 char *avahi_strdup_vprintf(const char *fmt, va_list ap) {
-    size_t len = 100;
+    size_t len = 80;
     char *buf;
     
     assert(fmt);
@@ -203,8 +203,13 @@ char *avahi_strdup_vprintf(const char *fmt, va_list ap) {
     for (;;) {
         int n;
         char *nbuf;
+        va_list ap2;
+
+        va_copy (ap2, ap);
         
-        n = vsnprintf(buf, len, fmt, ap);
+        n = vsnprintf(buf, len, fmt, ap2);
+
+        va_end (ap2);
 
         if (n >= 0 && n < (int) len)
             return buf;