@@ -33,7 +33,7 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
33
33
target_os = "watchos" ,
34
34
) ) ]
35
35
use crate :: sys:: weak:: syscall;
36
- #[ cfg( any( target_os = "android" , target_os = "macos" ) ) ]
36
+ #[ cfg( any( target_os = "android" , target_os = "macos" , target_os = "solaris" ) ) ]
37
37
use crate :: sys:: weak:: weak;
38
38
39
39
use libc:: { c_int, mode_t} ;
@@ -42,6 +42,7 @@ use libc::{c_int, mode_t};
42
42
target_os = "macos" ,
43
43
target_os = "ios" ,
44
44
target_os = "watchos" ,
45
+ target_os = "solaris" ,
45
46
all( target_os = "linux" , target_env = "gnu" )
46
47
) ) ]
47
48
use libc:: c_char;
@@ -1423,15 +1424,15 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> {
1423
1424
run_path_with_cstr ( original, |original| {
1424
1425
run_path_with_cstr ( link, |link| {
1425
1426
cfg_if:: cfg_if! {
1426
- if #[ cfg( any( target_os = "vxworks" , target_os = "redox" , target_os = "android" , target_os = "espidf" , target_os = "horizon" , target_os = "solaris" ) ) ] {
1427
- // VxWorks, Redox, ESP-IDF and Solaris lack `linkat`, so use `link` instead. POSIX leaves
1427
+ if #[ cfg( any( target_os = "vxworks" , target_os = "redox" , target_os = "android" , target_os = "espidf" , target_os = "horizon" ) ) ] {
1428
+ // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves
1428
1429
// it implementation-defined whether `link` follows symlinks, so rely on the
1429
1430
// `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior.
1430
1431
// Android has `linkat` on newer versions, but we happen to know `link`
1431
1432
// always has the correct behavior, so it's here as well.
1432
1433
cvt( unsafe { libc:: link( original. as_ptr( ) , link. as_ptr( ) ) } ) ?;
1433
- } else if #[ cfg( target_os = "macos" ) ] {
1434
- // On MacOS, older versions (<=10.9) lack support for linkat while newer
1434
+ } else if #[ cfg( any ( target_os = "macos" , target_os = "solaris" ) ) ] {
1435
+ // MacOS (<=10.9) and Solaris 10 lack support for linkat while newer
1435
1436
// versions have it. We want to use linkat if it is available, so we use weak!
1436
1437
// to check. `linkat` is preferable to `link` because it gives us a flag to
1437
1438
// specify how symlinks should be handled. We pass 0 as the flags argument,
0 commit comments