+ if (type != SSH2_FXP_STATUS)
+ fatal("Expected SSH2_FXP_STATUS(%d) packet, "
+ "got %d", SSH2_FXP_STATUS, type);
+
+ status = buffer_get_int(&msg);
+ debug3("SSH2_FXP_STATUS %d", status);
+
+ /* Find the request in our queue */
+ for(ack = TAILQ_FIRST(&acks);
+ ack != NULL && ack->id != id;
+ ack = TAILQ_NEXT(ack, tq))
+ ;
+ if (ack == NULL)
+ fatal("Can't find request for ID %d", id);
+ TAILQ_REMOVE(&acks, ack, tq);
+
+ if (status != SSH2_FX_OK) {
+ error("Couldn't write to remote file \"%s\": %s",
+ remote_path, fx2txt(status));
+ do_close(conn, handle, handle_len);
+ close(local_fd);
+ goto done;
+ }
+ debug3("In write loop, ack for %u %d bytes at %llu",
+ ack->id, ack->len, ack->offset);
+ ++ackid;
+ free(ack);
+ }