sw_build: Bug squashing.
[sw-tools] / src / sw_build.c
index 9a30260..7b30193 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sw_build.c,v 1.5 2004/04/08 01:52:19 mdw Exp $
+ * $Id$
  *
  * Management of build processes
  *
@@ -37,6 +37,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -404,8 +405,10 @@ int sw_run(int argc, char *argv[])
          } break;
 
          default: {
-           const static char msg[] = "\n[Unexpected packet, type %i]\n";
-           p->output(e, msg, sizeof(msg) - 1);
+           dstr d = DSTR_INIT;
+           dstr_putf(&d, "\n[Unexpected packet, type %i]\n", t);
+           p->output(e, d.buf, d.len);
+           dstr_destroy(&d);
          } break;
        }
       }
@@ -443,7 +446,7 @@ int sw_run(int argc, char *argv[])
   {
     archcons *aa;
     for (aa = a; aa; aa = aa->cdr)
-      free(a->car->r);
+      free(aa->car->r);
   }
 
   /* --- Tidy away the architecture list --- */
@@ -486,7 +489,7 @@ static void putf(sw_remote *r, FILE *fp, const char *fmt, ...)
   va_list ap;
   dstr d = DSTR_INIT;
   va_start(ap, fmt);
-  dstr_vputf(&d, fmt, ap);
+  dstr_vputf(&d, fmt, &ap);
   va_end(ap);
   if (r)
     pksend(r, PKTYPE_DATA, d.buf, d.len);