X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fvmhsbr.c;h=eb6e037875e72ba69ef81673fb148c05dd8f5fe6;hb=a01a41d031c796b526329a4170eb23f0ac93b949;hp=c8743959ee66b00fbf0b684f37bdc10cb37253c5;hpb=6ee86a18ee336cce7df303753e4989e519162cf5;p=mmh diff --git a/uip/vmhsbr.c b/uip/vmhsbr.c index c874395..eb6e037 100644 --- a/uip/vmhsbr.c +++ b/uip/vmhsbr.c @@ -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,6 +14,7 @@ #include #include +#include #include static char *types[] = { @@ -94,8 +97,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; @@ -106,7 +108,7 @@ peer2rc (struct record *rc) if (fp) { fseek (fp, 0L, SEEK_END); fprintf (fp, "%d: <--- %s %d: \"%*.*s\"\n", (int) getpid(), - types[rc->rc_type], rc->rc_len, + types[(unsigned char)rc->rc_type], rc->rc_len, rc->rc_len, rc->rc_len, rc->rc_data); fflush (fp); } @@ -127,7 +129,7 @@ rc2peer (char code, int len, char *data) if (fp) { fseek (fp, 0L, SEEK_END); fprintf (fp, "%d: ---> %s %d: \"%*.*s\"\n", (int) getpid(), - types[rc->rc_type], rc->rc_len, + types[(unsigned char)rc->rc_type], rc->rc_len, rc->rc_len, rc->rc_len, data); fflush (fp); }