- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2001/03/19 03:52:51
[sftp-client.c]
Report ssh connection closing correctly; ok deraadt@
diff --git a/sftp-client.c b/sftp-client.c
index b0007a7..7be73d2 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -29,7 +29,7 @@
/* XXX: copy between two remote sites */
#include "includes.h"
-RCSID("$OpenBSD: sftp-client.c,v 1.14 2001/03/16 08:16:17 djm Exp $");
+RCSID("$OpenBSD: sftp-client.c,v 1.15 2001/03/19 10:52:51 djm Exp $");
#include "ssh.h"
#include "buffer.h"
@@ -77,7 +77,9 @@
unsigned char buf[4096];
len = atomicio(read, fd, buf, 4);
- if (len != 4)
+ if (len == 0)
+ fatal("Connection closed");
+ else if (len == -1)
fatal("Couldn't read packet: %s", strerror(errno));
msg_len = GET_32BIT(buf);
@@ -86,7 +88,9 @@
while (msg_len) {
len = atomicio(read, fd, buf, MIN(msg_len, sizeof(buf)));
- if (len <= 0)
+ if (len == 0)
+ fatal("Connection closed");
+ else if (len == -1)
fatal("Couldn't read packet: %s", strerror(errno));
msg_len -= len;