SCP issues.

This commit is contained in:
Ray Hayes 2016-10-27 13:07:31 -07:00
parent c5c328b303
commit fb904806c1
2 changed files with 8 additions and 5 deletions

View File

@ -854,12 +854,10 @@ int
w32_ftruncate(int fd, off_t length) { w32_ftruncate(int fd, off_t length) {
CHECK_FD(fd); CHECK_FD(fd);
if (!SetFilePointer(w32_fd_to_handle(fd), length, 0, FILE_BEGIN))
return -1;
if (!SetEndOfFile(w32_fd_to_handle(fd))) if (!SetEndOfFile(w32_fd_to_handle(fd)))
return -1; return -1;
if (!SetFileValidData(w32_fd_to_handle(fd), length))
return -1;
if (!SetFilePointer(w32_fd_to_handle(fd), 0, 0, FILE_BEGIN))
return -1;
return 0; return 0;
} }

7
scp.c
View File

@ -919,6 +919,11 @@ main(int argc, char **argv)
extern int optind; extern int optind;
#ifdef WINDOWS #ifdef WINDOWS
/*
* Initialize I/O wrappers.
*/
w32posix_initialize();
ConInit(STD_OUTPUT_HANDLE, TRUE); ConInit(STD_OUTPUT_HANDLE, TRUE);
#endif #endif
@ -1079,7 +1084,7 @@ main(int argc, char **argv)
exit(errs != 0); exit(errs != 0);
} }
if (tflag) { if (tflag) {
/* Receive data. */ /* Receive data. */
sink(argc, argv); sink(argc, argv);
exit(errs != 0); exit(errs != 0);
} }