]> andersk Git - openssh.git/blobdiff - sshconnect.c
- avsm@cvs.openbsd.org 2005/05/24 17:32:44
[openssh.git] / sshconnect.c
index 07703cf770914ac71c57c7d8e1a3d95a8d742c9d..b79cead5db47c7ff60dfbc54b070be5fbddb7a60 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.162 2005/03/10 22:01:06 deraadt Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.163 2005/05/24 17:32:44 avsm Exp $");
 
 #include <openssl/bn.h>
 
@@ -426,14 +426,15 @@ ssh_exchange_identification(void)
        int connection_out = packet_get_connection_out();
        int minor1 = PROTOCOL_MINOR_1;
 
-       /* Read other side\'s version identification. */
+       /* Read other side's version identification. */
        for (;;) {
                for (i = 0; i < sizeof(buf) - 1; i++) {
-                       int len = atomicio(read, connection_in, &buf[i], 1);
-                       if (len < 0)
-                               fatal("ssh_exchange_identification: read: %.100s", strerror(errno));
-                       if (len != 1)
+                       size_t len = atomicio(read, connection_in, &buf[i], 1);
+
+                       if (len != 1 && errno == EPIPE) 
                                fatal("ssh_exchange_identification: Connection closed by remote host");
+                       else if (len != 1)
+                               fatal("ssh_exchange_identification: read: %.100s", strerror(errno));
                        if (buf[i] == '\r') {
                                buf[i] = '\n';
                                buf[i + 1] = 0;
This page took 0.44839 seconds and 4 git commands to generate.