version 1.36, 2002/11/05 20:10:37 |
version 1.37, 2002/11/21 23:03:51 |
|
|
(unsigned long long)req->offset + len - 1); |
(unsigned long long)req->offset + len - 1); |
if (len > req->len) |
if (len > req->len) |
fatal("Received more data than asked for " |
fatal("Received more data than asked for " |
"%u > %u", len, req->len); |
"%u > %u", len, req->len); |
if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || |
if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || |
atomicio(write, local_fd, data, len) != len) && |
atomicio(write, local_fd, data, len) != len) && |
!write_error) { |
!write_error) { |
write_errno = errno; |
write_errno = errno; |
write_error = 1; |
write_error = 1; |
|
|
/* Override umask and utimes if asked */ |
/* Override umask and utimes if asked */ |
if (pflag && fchmod(local_fd, mode) == -1) |
if (pflag && fchmod(local_fd, mode) == -1) |
error("Couldn't set mode on \"%s\": %s", local_path, |
error("Couldn't set mode on \"%s\": %s", local_path, |
strerror(errno)); |
strerror(errno)); |
if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) { |
if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) { |
struct timeval tv[2]; |
struct timeval tv[2]; |
tv[0].tv_sec = a->atime; |
tv[0].tv_sec = a->atime; |
|
|
tv[0].tv_usec = tv[1].tv_usec = 0; |
tv[0].tv_usec = tv[1].tv_usec = 0; |
if (utimes(local_path, tv) == -1) |
if (utimes(local_path, tv) == -1) |
error("Can't set times on \"%s\": %s", |
error("Can't set times on \"%s\": %s", |
local_path, strerror(errno)); |
local_path, strerror(errno)); |
} |
} |
} |
} |
close(local_fd); |
close(local_fd); |
|
|
buffer_put_string(&msg, data, len); |
buffer_put_string(&msg, data, len); |
send_msg(conn->fd_out, &msg); |
send_msg(conn->fd_out, &msg); |
debug3("Sent message SSH2_FXP_WRITE I:%u O:%llu S:%u", |
debug3("Sent message SSH2_FXP_WRITE I:%u O:%llu S:%u", |
id, (unsigned long long)offset, len); |
id, (unsigned long long)offset, len); |
} else if (TAILQ_FIRST(&acks) == NULL) |
} else if (TAILQ_FIRST(&acks) == NULL) |
break; |
break; |
|
|
|
|
|
|
if (status != SSH2_FX_OK) { |
if (status != SSH2_FX_OK) { |
error("Couldn't write to remote file \"%s\": %s", |
error("Couldn't write to remote file \"%s\": %s", |
remote_path, fx2txt(status)); |
remote_path, fx2txt(status)); |
do_close(conn, handle, handle_len); |
do_close(conn, handle, handle_len); |
close(local_fd); |
close(local_fd); |
goto done; |
goto done; |