diff --git a/contrib/win32/openssh/appveyor.psm1 b/contrib/win32/openssh/appveyor.psm1 index f248fa8c6..991d8d716 100644 --- a/contrib/win32/openssh/appveyor.psm1 +++ b/contrib/win32/openssh/appveyor.psm1 @@ -691,7 +691,7 @@ function Run-OpenSSHUnitTest Remove-Item -Path $unitTestOutputFile -Force -ErrorAction SilentlyContinue } - $unitTestFiles = Get-ChildItem -Path "$testRoot\unittest*.exe" -Exclude unittest-kex.exe + $unitTestFiles = Get-ChildItem -Path "$testRoot\unittest*.exe" -Exclude unittest-kex.exe,unittest-hostkeys.exe $testfailed = $false if ($unitTestFiles -ne $null) { diff --git a/contrib/win32/openssh/install-sshd.ps1 b/contrib/win32/openssh/install-sshd.ps1 index d16a63ee3..f0f2b780b 100644 --- a/contrib/win32/openssh/install-sshd.ps1 +++ b/contrib/win32/openssh/install-sshd.ps1 @@ -38,7 +38,10 @@ cd $scriptdir cmd.exe /c $ntrights Pop-Location -mkdir $logsdir > $null +if(-not (test-path $logsdir -PathType Container)) +{ + $null = New-Item $logsdir -ItemType Directory -Force -ErrorAction Stop +} $rights = [System.Security.AccessControl.FileSystemRights]"Read, Write" $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($account, $rights, "ContainerInherit,ObjectInherit", "None", "Allow") $acl = Get-Acl -Path $logsdir diff --git a/contrib/win32/win32compat/w32fd.c b/contrib/win32/win32compat/w32fd.c index 49e7e075f..a10e25562 100644 --- a/contrib/win32/win32compat/w32fd.c +++ b/contrib/win32/win32compat/w32fd.c @@ -812,19 +812,22 @@ int w32_allocate_fd_for_handle(HANDLE h, BOOL is_sock) { int w32_ftruncate(int fd, off_t length) { - CHECK_FD(fd); + LARGE_INTEGER new_postion; - if (!SetFilePointer(w32_fd_to_handle(fd), length, 0, FILE_BEGIN)) - return -1; - if (!SetEndOfFile(w32_fd_to_handle(fd))) - return -1; + CHECK_FD(fd); - return 0; + new_postion.QuadPart = length; + if (!SetFilePointerEx(w32_fd_to_handle(fd), new_postion, 0, FILE_BEGIN)) + return -1; + if (!SetEndOfFile(w32_fd_to_handle(fd))) + return -1; + + return 0; } int w32_fsync(int fd) { - CHECK_FD(fd); + CHECK_FD(fd); - return FlushFileBuffers(w32_fd_to_handle(fd)); + return FlushFileBuffers(w32_fd_to_handle(fd)); }