summaryrefslogtreecommitdiff
path: root/msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/msg.c b/msg.c
index 1bd20f3d3..99c25cd25 100644
--- a/msg.c
+++ b/msg.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: msg.c,v 1.17 2018/07/09 21:59:10 markus Exp $ */ 1/* $OpenBSD: msg.c,v 1.18 2020/01/22 04:49:16 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -47,16 +47,16 @@ ssh_msg_send(int fd, u_char type, struct sshbuf *m)
47 u_char buf[5]; 47 u_char buf[5];
48 u_int mlen = sshbuf_len(m); 48 u_int mlen = sshbuf_len(m);
49 49
50 debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff); 50 debug3("%s: type %u", __func__, (unsigned int)type & 0xff);
51 51
52 put_u32(buf, mlen + 1); 52 put_u32(buf, mlen + 1);
53 buf[4] = type; /* 1st byte of payload is mesg-type */ 53 buf[4] = type; /* 1st byte of payload is mesg-type */
54 if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) { 54 if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) {
55 error("ssh_msg_send: write"); 55 error("%s: write: %s", __func__, strerror(errno));
56 return (-1); 56 return (-1);
57 } 57 }
58 if (atomicio(vwrite, fd, sshbuf_mutable_ptr(m), mlen) != mlen) { 58 if (atomicio(vwrite, fd, sshbuf_mutable_ptr(m), mlen) != mlen) {
59 error("ssh_msg_send: write"); 59 error("%s: write: %s", __func__, strerror(errno));
60 return (-1); 60 return (-1);
61 } 61 }
62 return (0); 62 return (0);
@@ -73,12 +73,12 @@ ssh_msg_recv(int fd, struct sshbuf *m)
73 73
74 if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) { 74 if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) {
75 if (errno != EPIPE) 75 if (errno != EPIPE)
76 error("ssh_msg_recv: read: header"); 76 error("%s: read header: %s", __func__, strerror(errno));
77 return (-1); 77 return (-1);
78 } 78 }
79 msg_len = get_u32(buf); 79 msg_len = get_u32(buf);
80 if (msg_len > 256 * 1024) { 80 if (msg_len > 256 * 1024) {
81 error("ssh_msg_recv: read: bad msg_len %u", msg_len); 81 error("%s: read: bad msg_len %u", __func__, msg_len);
82 return (-1); 82 return (-1);
83 } 83 }
84 sshbuf_reset(m); 84 sshbuf_reset(m);
@@ -87,7 +87,7 @@ ssh_msg_recv(int fd, struct sshbuf *m)
87 return -1; 87 return -1;
88 } 88 }
89 if (atomicio(read, fd, p, msg_len) != msg_len) { 89 if (atomicio(read, fd, p, msg_len) != msg_len) {
90 error("ssh_msg_recv: read: %s", strerror(errno)); 90 error("%s: read: %s", __func__, strerror(errno));
91 return (-1); 91 return (-1);
92 } 92 }
93 return (0); 93 return (0);