]> diplodocus.org Git - nmh/blobdiff - uip/vmhsbr.c
Add a new (but incomplete) test for mhbuild's new functionality.
[nmh] / uip / vmhsbr.c
index cc92b49bbe91a13a5386b09277ab6d6d48eff081..4c0c8c186e887aa55be4e5cff7afc98596ca6809 100644 (file)
@@ -2,7 +2,9 @@
 /*
  * vmhsbr.c -- routines to help vmh along
  *
- * $Id$
+ * This code is Copyright (c) 2002, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
  */
 
 /*
@@ -12,7 +14,7 @@
 
 #include <h/mh.h>
 #include <h/vmhsbr.h>
-#include <errno.h>
+#include <h/utils.h>
 
 static char *types[] = {
     "OK",
@@ -94,8 +96,7 @@ peer2rc (struct record *rc)
     if (read (PEERrfd, (char *) rc_head (rc), RHSIZE (rc)) != RHSIZE (rc))
        return rclose (rc, "read from peer lost(1)");
     if (rc->rc_len) {
-       if ((rc->rc_data = malloc ((unsigned) rc->rc_len + 1)) == NULL)
-           return rclose (rc, "malloc of %d lost", rc->rc_len + 1);
+       rc->rc_data = mh_xmalloc ((unsigned) rc->rc_len + 1);
        if (read (PEERrfd, rc->rc_data, rc->rc_len) != rc->rc_len)
            return rclose (rc, "read from peer lost(2)");
        rc->rc_data[rc->rc_len] = 0;
@@ -153,11 +154,13 @@ str2peer (char code, char *str)
 int
 fmt2peer (char code, char *fmt, ...)
 {
+    int     return_value;
     va_list ap;
 
     va_start(ap, fmt);
-    return verr2peer (code, NULL, fmt, ap);
+    return_value = verr2peer (code, NULL, fmt, ap);
     va_end(ap);
+    return return_value;
 }