=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sftp-client.c,v retrieving revision 1.47.2.2 retrieving revision 1.48 diff -u -r1.47.2.2 -r1.48 --- src/usr.bin/ssh/sftp-client.c 2005/03/10 17:15:04 1.47.2.2 +++ src/usr.bin/ssh/sftp-client.c 2004/03/30 12:41:56 1.48 @@ -20,7 +20,7 @@ /* XXX: copy between two remote sites */ #include "includes.h" -RCSID("$OpenBSD: sftp-client.c,v 1.47.2.2 2005/03/10 17:15:04 brad Exp $"); +RCSID("$OpenBSD: sftp-client.c,v 1.48 2004/03/30 12:41:56 djm Exp $"); #include @@ -36,7 +36,6 @@ #include "sftp-common.h" #include "sftp-client.h" -extern volatile sig_atomic_t interrupted; extern int showprogress; /* Minimum amount of data to read at at time */ @@ -172,7 +171,6 @@ int status = buffer_get_int(&msg); error("Couldn't get handle: %s", fx2txt(status)); - buffer_free(&msg); return(NULL); } else if (type != SSH2_FXP_HANDLE) fatal("Expected SSH2_FXP_HANDLE(%u) packet, got %u", @@ -207,7 +205,6 @@ debug("Couldn't stat remote file: %s", fx2txt(status)); else error("Couldn't stat remote file: %s", fx2txt(status)); - buffer_free(&msg); return(NULL); } else if (type != SSH2_FXP_ATTRS) { fatal("Expected SSH2_FXP_ATTRS(%u) packet, got %u", @@ -333,7 +330,7 @@ (*dir)[0] = NULL; } - for (; !interrupted;) { + for (;;) { int count; id = expected_id = conn->msg_id++; @@ -410,13 +407,6 @@ do_close(conn, handle, handle_len); xfree(handle); - /* Don't return partial matches on interrupt */ - if (interrupted && dir != NULL && *dir != NULL) { - free_sftp_dirents(*dir); - *dir = xmalloc(sizeof(**dir)); - **dir = NULL; - } - return(0); } @@ -822,16 +812,6 @@ char *data; u_int len; - /* - * Simulate EOF on interrupt: stop sending new requests and - * allow outstanding requests to drain gracefully - */ - if (interrupted) { - if (num_req == 0) /* If we haven't started yet... */ - break; - max_req = 0; - } - /* Send some more requests */ while (num_req < max_req) { debug3("Request range %llu -> %llu (%d/%d)", @@ -919,7 +899,8 @@ (unsigned long long)offset, num_req); max_req = 1; - } else if (max_req <= conn->num_requests) { + } + else if (max_req < conn->num_requests + 1) { ++max_req; } } @@ -990,7 +971,7 @@ TAILQ_ENTRY(outstanding_ack) tq; }; TAILQ_HEAD(ackhead, outstanding_ack) acks; - struct outstanding_ack *ack = NULL; + struct outstanding_ack *ack; TAILQ_INIT(&acks); @@ -1051,14 +1032,10 @@ int len; /* - * Can't use atomicio here because it returns 0 on EOF, - * thus losing the last block of the file. - * Simulate an EOF on interrupt, allowing ACKs from the - * server to drain. + * Can't use atomicio here because it returns 0 on EOF, thus losing + * the last block of the file */ - if (interrupted) - len = 0; - else do + do len = read(local_fd, data, conn->transfer_buflen); while ((len == -1) && (errno == EINTR || errno == EAGAIN));