Skip to content

Commit fb90480

Browse files
committed
SCP issues.
1 parent c5c328b commit fb90480

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

contrib/win32/win32compat/w32fd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,9 @@ int
854854
w32_ftruncate(int fd, off_t length) {
855855
CHECK_FD(fd);
856856

857-
if (!SetEndOfFile(w32_fd_to_handle(fd)))
858-
return -1;
859-
if (!SetFileValidData(w32_fd_to_handle(fd), length))
857+
if (!SetFilePointer(w32_fd_to_handle(fd), length, 0, FILE_BEGIN))
860858
return -1;
861-
if (!SetFilePointer(w32_fd_to_handle(fd), 0, 0, FILE_BEGIN))
859+
if (!SetEndOfFile(w32_fd_to_handle(fd)))
862860
return -1;
863861

864862
return 0;

scp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,11 @@ main(int argc, char **argv)
919919
extern int optind;
920920

921921
#ifdef WINDOWS
922+
/*
923+
* Initialize I/O wrappers.
924+
*/
925+
926+
w32posix_initialize();
922927
ConInit(STD_OUTPUT_HANDLE, TRUE);
923928
#endif
924929

@@ -1079,7 +1084,7 @@ main(int argc, char **argv)
10791084
exit(errs != 0);
10801085
}
10811086
if (tflag) {
1082-
/* Receive data. */
1087+
/* Receive data. */
10831088
sink(argc, argv);
10841089
exit(errs != 0);
10851090
}

0 commit comments

Comments
 (0)