summaryrefslogtreecommitdiff
path: root/msg.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-10-03 15:45:53 +1000
committerDamien Miller <djm@mindrot.org>2002-10-03 15:45:53 +1000
commit1c992c4c13ea6c8fcd80093b340bc49753e17a4f (patch)
treeedce662953498001757b92ba16f7c9d5f8b752c5 /msg.c
parent7e659de6f981aaf1059720e5e198aa652834e414 (diff)
- (djm) Bug #406 s/msg_send/ssh_msh_send/ for Mac OS X 1.2
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/msg.c b/msg.c
index de19b057f..107a37691 100644
--- a/msg.c
+++ b/msg.c
@@ -31,43 +31,43 @@ RCSID("$OpenBSD: msg.c,v 1.4 2002/07/01 16:15:25 deraadt Exp $");
31#include "msg.h" 31#include "msg.h"
32 32
33void 33void
34msg_send(int fd, u_char type, Buffer *m) 34ssh_msg_send(int fd, u_char type, Buffer *m)
35{ 35{
36 u_char buf[5]; 36 u_char buf[5];
37 u_int mlen = buffer_len(m); 37 u_int mlen = buffer_len(m);
38 38
39 debug3("msg_send: type %u", (unsigned int)type & 0xff); 39 debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff);
40 40
41 PUT_32BIT(buf, mlen + 1); 41 PUT_32BIT(buf, mlen + 1);
42 buf[4] = type; /* 1st byte of payload is mesg-type */ 42 buf[4] = type; /* 1st byte of payload is mesg-type */
43 if (atomicio(write, fd, buf, sizeof(buf)) != sizeof(buf)) 43 if (atomicio(write, fd, buf, sizeof(buf)) != sizeof(buf))
44 fatal("msg_send: write"); 44 fatal("ssh_msg_send: write");
45 if (atomicio(write, fd, buffer_ptr(m), mlen) != mlen) 45 if (atomicio(write, fd, buffer_ptr(m), mlen) != mlen)
46 fatal("msg_send: write"); 46 fatal("ssh_msg_send: write");
47} 47}
48 48
49int 49int
50msg_recv(int fd, Buffer *m) 50ssh_msg_recv(int fd, Buffer *m)
51{ 51{
52 u_char buf[4]; 52 u_char buf[4];
53 ssize_t res; 53 ssize_t res;
54 u_int msg_len; 54 u_int msg_len;
55 55
56 debug3("msg_recv entering"); 56 debug3("ssh_msg_recv entering");
57 57
58 res = atomicio(read, fd, buf, sizeof(buf)); 58 res = atomicio(read, fd, buf, sizeof(buf));
59 if (res != sizeof(buf)) { 59 if (res != sizeof(buf)) {
60 if (res == 0) 60 if (res == 0)
61 return -1; 61 return -1;
62 fatal("msg_recv: read: header %ld", (long)res); 62 fatal("ssh_msg_recv: read: header %ld", (long)res);
63 } 63 }
64 msg_len = GET_32BIT(buf); 64 msg_len = GET_32BIT(buf);
65 if (msg_len > 256 * 1024) 65 if (msg_len > 256 * 1024)
66 fatal("msg_recv: read: bad msg_len %u", msg_len); 66 fatal("ssh_msg_recv: read: bad msg_len %u", msg_len);
67 buffer_clear(m); 67 buffer_clear(m);
68 buffer_append_space(m, msg_len); 68 buffer_append_space(m, msg_len);
69 res = atomicio(read, fd, buffer_ptr(m), msg_len); 69 res = atomicio(read, fd, buffer_ptr(m), msg_len);
70 if (res != msg_len) 70 if (res != msg_len)
71 fatal("msg_recv: read: %ld != msg_len", (long)res); 71 fatal("ssh_msg_recv: read: %ld != msg_len", (long)res);
72 return 0; 72 return 0;
73} 73}