Bugzilla – Attachment 1286 Details for
Bug 799
scp incorrectly reports "stalled" on slow copies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
increment counters for short writes
scp-smallwrite.diff (text/plain), 1.75 KB, created by
Damien Miller
on 2007-05-17 20:08:42 AEST
(
hide
)
Description:
increment counters for short writes
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2007-05-17 20:08:42 AEST
Size:
1.75 KB
patch
obsolete
>Index: scp.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/scp.c,v >retrieving revision 1.156 >diff -u -p -r1.156 scp.c >--- scp.c 22 Jan 2007 13:06:21 -0000 1.156 >+++ scp.c 17 May 2007 10:06:58 -0000 >@@ -567,7 +567,8 @@ source(int argc, char **argv) > static BUF buffer; > BUF *bp; > off_t i, amt, statbytes; >- size_t result; >+ size_t result, o; >+ ssize_t sresult; > int fd = -1, haderr, indx; > char *last, *name, buf[2048]; > int len; >@@ -648,13 +649,21 @@ next: if (fd != -1) { > if (result != amt) > haderr = errno; > } >- if (haderr) >- (void) atomicio(vwrite, remout, bp->buf, amt); >- else { >- result = atomicio(vwrite, remout, bp->buf, amt); >- if (result != amt) >- haderr = errno; >- statbytes += result; >+ for (o = 0; o < amt;) { >+ sresult = write(remout, bp->buf + o, amt - o); >+ if (sresult == 0) { >+ sresult = -1; >+ errno = EPIPE; >+ } >+ if (sresult == -1) { >+ if (errno == EAGAIN || errno == EINTR) >+ continue; >+ if (!haderr) >+ haderr = errno; >+ break; >+ } >+ statbytes += sresult; >+ o += sresult; > } > if (limit_rate) > bwlimit(amt); >@@ -792,7 +801,8 @@ sink(int argc, char **argv) > } wrerr; > BUF *bp; > off_t i; >- size_t j, count; >+ size_t count; >+ ssize_t j; > int amt, exists, first, ofd; > mode_t mode, omode, mask; > off_t size, statbytes; >@@ -974,8 +984,11 @@ bad: run_err("%s: %s", np, strerror(er > amt = size - i; > count += amt; > do { >- j = atomicio(read, remin, cp, amt); >- if (j == 0) { >+ j = read(remin, cp, amt); >+ if (j == -1 && >+ (errno == EAGAIN || errno == EINTR)) >+ continue; >+ if (j <= 0) { > run_err("%s", j ? strerror(errno) : > "dropped connection"); > exit(1);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 799
:
1286
|
1302