SFTP fix to download a very large file in chunks #863 (#227)

PowerShell/Win32-OpenSSH#863
This commit is contained in:
bagajjal 2017-11-20 23:25:01 -08:00 committed by Manoj Ampalam
parent 495119e23f
commit bcf9c5336f
4 changed files with 7 additions and 6 deletions

View File

@ -811,7 +811,7 @@ cleanup:
}
long
fileio_lseek(struct w32_io* pio, long offset, int origin)
fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin)
{
debug4("lseek - pio:%p", pio);
if (origin != SEEK_SET) {
@ -820,8 +820,9 @@ fileio_lseek(struct w32_io* pio, long offset, int origin)
return -1;
}
pio->read_overlapped.Offset = offset;
pio->write_overlapped.Offset = offset;
pio->write_overlapped.Offset = pio->read_overlapped.Offset = offset & 0xffffffff;
pio->write_overlapped.OffsetHigh = pio->read_overlapped.OffsetHigh = (offset & 0xffffffff00000000) >> 32;
return 0;
}

View File

@ -46,7 +46,7 @@ int w32_dup2(int oldfd, int newfd);
unsigned int w32_alarm(unsigned int seconds);
#define alarm w32_alarm
long w32_lseek(int fd, long offset, int origin);
long w32_lseek(int fd, unsigned __int64 offset, int origin);
#define lseek w32_lseek
#define getdtablesize() MAX_FDS

View File

@ -484,7 +484,7 @@ w32_fstat(int fd, struct w32_stat *buf)
}
long
w32_lseek(int fd, long offset, int origin)
w32_lseek(int fd, unsigned __int64 offset, int origin)
{
CHECK_FD(fd);
return fileio_lseek(fd_table.w32_ios[fd], offset, origin);

View File

@ -163,5 +163,5 @@ int fileio_read(struct w32_io* pio, void *dst, size_t max);
int fileio_write(struct w32_io* pio, const void *buf, size_t max);
int fileio_fstat(struct w32_io* pio, struct _stat64 *buf);
int fileio_stat(const char *path, struct _stat64 *buf);
long fileio_lseek(struct w32_io* pio, long offset, int origin);
long fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin);
FILE* fileio_fdopen(struct w32_io* pio, const char *mode);