]> andersk Git - gssapi-openssh.git/blobdiff - openssh/monitor_wrap.c
Import of OpenSSH 4.2p1
[gssapi-openssh.git] / openssh / monitor_wrap.c
index e1b6512b42ca193c1c5b2e66b4a88cb1fa5d669b..1489e7f08f8244609944ff6d1c1c12df01b69381 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: monitor_wrap.c,v 1.39 2004/07/17 05:31:41 dtucker Exp $");
+RCSID("$OpenBSD: monitor_wrap.c,v 1.40 2005/05/24 17:32:43 avsm Exp $");
 
 #include <openssl/bn.h>
 #include <openssl/dh.h>
@@ -95,9 +95,9 @@ mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
        PUT_32BIT(buf, mlen + 1);
        buf[4] = (u_char) type;         /* 1st byte of payload is mesg-type */
        if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
-               fatal("%s: write", __func__);
+               fatal("%s: write: %s", __func__, strerror(errno));
        if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen)
-               fatal("%s: write", __func__);
+               fatal("%s: write: %s", __func__, strerror(errno));
 }
 
 void
@@ -105,24 +105,21 @@ mm_request_receive(int sock, Buffer *m)
 {
        u_char buf[4];
        u_int msg_len;
-       ssize_t res;
 
        debug3("%s entering", __func__);
 
-       res = atomicio(read, sock, buf, sizeof(buf));
-       if (res != sizeof(buf)) {
-               if (res == 0)
+       if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) {
+               if (errno == EPIPE)
                        cleanup_exit(255);
-               fatal("%s: read: %ld", __func__, (long)res);
+               fatal("%s: read: %s", __func__, strerror(errno));
        }
        msg_len = GET_32BIT(buf);
        if (msg_len > 256 * 1024)
                fatal("%s: read: bad msg_len %d", __func__, msg_len);
        buffer_clear(m);
        buffer_append_space(m, msg_len);
-       res = atomicio(read, sock, buffer_ptr(m), msg_len);
-       if (res != msg_len)
-               fatal("%s: read: %ld != msg_len", __func__, (long)res);
+       if (atomicio(read, sock, buffer_ptr(m), msg_len) != msg_len)
+               fatal("%s: read: %s", __func__, strerror(errno));
 }
 
 void
@@ -767,7 +764,8 @@ mm_sshpam_query(void *ctx, char **name, char **info,
     u_int *num, char ***prompts, u_int **echo_on)
 {
        Buffer m;
-       int i, ret;
+       u_int i;
+       int ret;
 
        debug3("%s", __func__);
        buffer_init(&m);
@@ -793,7 +791,8 @@ int
 mm_sshpam_respond(void *ctx, u_int num, char **resp)
 {
        Buffer m;
-       int i, ret;
+       u_int i;
+       int ret;
 
        debug3("%s", __func__);
        buffer_init(&m);
This page took 0.032717 seconds and 4 git commands to generate.