Bugzilla – Attachment 889 Details for
Bug 626
sftp is unable to resume interrupted downloads/ uploads
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Implement truncation at "high water mark" on error
sftp-highwater.diff (text/plain), 1.52 KB, created by
Damien Miller
on 2005-04-21 16:33:15 AEST
(
hide
)
Description:
Implement truncation at "high water mark" on error
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2005-04-21 16:33:15 AEST
Size:
1.52 KB
patch
obsolete
>Index: sftp-client.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sftp-client.c,v >retrieving revision 1.53 >diff -u -p -r1.53 sftp-client.c >--- sftp-client.c 10 Mar 2005 22:01:05 -0000 1.53 >+++ sftp-client.c 21 Apr 2005 06:30:23 -0000 >@@ -745,7 +745,7 @@ do_download(struct sftp_conn *conn, char > char *handle; > int local_fd, status, num_req, max_req, write_error; > int read_error, write_errno; >- u_int64_t offset, size; >+ u_int64_t offset, size, highwater; > u_int handle_len, mode, type, id, buflen; > off_t progress_counter; > struct request { >@@ -812,6 +812,7 @@ do_download(struct sftp_conn *conn, char > > /* Read from remote and write to local */ > write_error = read_error = write_errno = num_req = offset = 0; >+ highwater = 0; > max_req = 1; > progress_counter = 0; > >@@ -887,7 +888,9 @@ do_download(struct sftp_conn *conn, char > write_errno = errno; > write_error = 1; > max_req = 0; >- } >+ } else if (req->offset <= highwater) >+ highwater = req->offset + len; >+ > progress_counter += len; > xfree(data); > >@@ -936,6 +939,12 @@ do_download(struct sftp_conn *conn, char > /* Sanity check */ > if (TAILQ_FIRST(&requests) != NULL) > fatal("Transfer complete, but requests still in queue"); >+ >+ /* Truncate at highest contiguous point to avoid holes on interrupt */ >+ if (read_error || write_error || interrupted) { >+ debug("truncating at %llu", highwater); >+ ftruncate(local_fd, highwater); >+ } > > if (read_error) { > error("Couldn't read from remote file \"%s\" : %s",
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 626
: 889