]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2006/04/16 00:54:10
authordjm <djm>
Sun, 23 Apr 2006 02:06:35 +0000 (02:06 +0000)
committerdjm <djm>
Sun, 23 Apr 2006 02:06:35 +0000 (02:06 +0000)
     [sftp-client.c]
     avoid making a tiny 4-byte write to send the packet length of sftp
     commands, which would result in a separate tiny packet on the wire by
     using atomiciov(writev, ...) to write the length and the command in one
     pass; ok deraadt@

ChangeLog
sftp-client.c

index e09d3023ac4f829b3f5c5209f0357fcd04f75040..89fce1a22df93508aefa5ef902387f187591eba8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
      introduce atomiciov() function that wraps readv/writev to retry
      interrupted transfers like atomicio() does for read/write;
      feedback deraadt@ dtucker@ stevesk@ ok deraadt@
+   - djm@cvs.openbsd.org 2006/04/16 00:54:10
+     [sftp-client.c]
+     avoid making a tiny 4-byte write to send the packet length of sftp
+     commands, which would result in a separate tiny packet on the wire by
+     using atomiciov(writev, ...) to write the length and the command in one
+     pass; ok deraadt@
 
 20060421
  - (djm) [Makefile.in configure.ac session.c sshpty.c]
index c71c66f330bda891990332f33b00af49e11bf460..8778439b95362bce8f3fdf43b6d6040f7dca1142 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-client.c,v 1.64 2006/03/30 09:58:16 djm Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.65 2006/04/16 00:54:10 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -61,16 +61,19 @@ static void
 send_msg(int fd, Buffer *m)
 {
        u_char mlen[4];
+       struct iovec iov[2];
 
        if (buffer_len(m) > SFTP_MAX_MSG_LENGTH)
                fatal("Outbound message too long %u", buffer_len(m));
 
        /* Send length first */
        put_u32(mlen, buffer_len(m));
-       if (atomicio(vwrite, fd, mlen, sizeof(mlen)) != sizeof(mlen))
-               fatal("Couldn't send packet: %s", strerror(errno));
-
-       if (atomicio(vwrite, fd, buffer_ptr(m), buffer_len(m)) != buffer_len(m))
+       iov[0].iov_base = mlen;
+       iov[0].iov_len = sizeof(mlen);
+       iov[1].iov_base = buffer_ptr(m);
+       iov[1].iov_len = buffer_len(m);
+       
+       if (atomiciov(writev, fd, iov, 2) != buffer_len(m) + sizeof(mlen))
                fatal("Couldn't send packet: %s", strerror(errno));
 
        buffer_clear(m);
This page took 0.09545 seconds and 5 git commands to generate.