1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #1440 from rivy/fix.win-legacy

Fix for legacy Windows versions
This commit is contained in:
Roy Ivy III 2020-04-07 16:53:13 -05:00 committed by GitHub
commit 683db28a93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View file

@ -39,6 +39,15 @@ unix = [
"generic"
]
windows = ["generic"]
windows_legacy = [
"arch",
"nproc",
"sync",
"touch",
"whoami",
"redox_generic"
]
# Feature "fuchsia" contains the exclusive list of utilities
# that can be compiled and run on Fuchsia. Should be built
# with --no-default-features when selecting this feature.

View file

@ -16,7 +16,7 @@ pub fn main() {
if val == "1" && key.starts_with(feature_prefix) {
let krate = key[feature_prefix.len()..].to_lowercase();
match krate.as_ref() {
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "windows"
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "windows" | "windows_legacy"
| "nightly" | "test_unimplemented" => continue,
_ => {}
}

View file

@ -29,7 +29,7 @@ extern crate kernel32;
#[cfg(windows)]
use kernel32::GetFileInformationByHandle;
#[cfg(windows)]
use kernel32::CreateFile2;
use kernel32::CreateFileW;
#[cfg(windows)]
extern crate winapi;
@ -731,10 +731,12 @@ fn preserve_hardlinks(
#[cfg(windows)]
{
let stat = mem::uninitialized();
let handle = CreateFile2(
let handle = CreateFileW(
src_path.as_ptr() as *const u16,
winapi::um::winnt::GENERIC_READ,
winapi::um::winnt::FILE_SHARE_READ,
std::ptr::null_mut(),
0,
0,
std::ptr::null_mut(),
);