@@ -18,10 +18,10 @@ use libc::{gid_t, uid_t};
18
18
use options:: traverse;
19
19
use std:: ffi:: OsString ;
20
20
21
- #[ cfg( not( all ( target_os = "linux" , feature = "safe-traversal" ) ) ) ]
21
+ #[ cfg( not( target_os = "linux" ) ) ]
22
22
use walkdir:: WalkDir ;
23
23
24
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
24
+ #[ cfg( target_os = "linux" ) ]
25
25
use crate :: features:: safe_traversal:: DirFd ;
26
26
27
27
use std:: ffi:: CString ;
@@ -308,7 +308,7 @@ impl ChownExecutor {
308
308
309
309
let ret = if self . matched ( meta. uid ( ) , meta. gid ( ) ) {
310
310
// Use safe syscalls for root directory to prevent TOCTOU attacks
311
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
311
+ #[ cfg( target_os = "linux" ) ]
312
312
let chown_result = if path. is_dir ( ) {
313
313
// For directories, use safe traversal from the start
314
314
match DirFd :: open ( path) {
@@ -331,7 +331,7 @@ impl ChownExecutor {
331
331
)
332
332
} ;
333
333
334
- #[ cfg( not( all ( target_os = "linux" , feature = "safe-traversal" ) ) ) ]
334
+ #[ cfg( not( target_os = "linux" ) ) ]
335
335
let chown_result = wrap_chown (
336
336
path,
337
337
& meta,
@@ -365,11 +365,11 @@ impl ChownExecutor {
365
365
} ;
366
366
367
367
if self . recursive {
368
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
368
+ #[ cfg( target_os = "linux" ) ]
369
369
{
370
370
ret | self . safe_dive_into ( & root)
371
371
}
372
- #[ cfg( not( all ( target_os = "linux" , feature = "safe-traversal" ) ) ) ]
372
+ #[ cfg( not( target_os = "linux" ) ) ]
373
373
{
374
374
ret | self . dive_into ( & root)
375
375
}
@@ -378,7 +378,7 @@ impl ChownExecutor {
378
378
}
379
379
}
380
380
381
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
381
+ #[ cfg( target_os = "linux" ) ]
382
382
fn safe_chown_dir (
383
383
& self ,
384
384
dir_fd : & DirFd ,
@@ -399,7 +399,7 @@ impl ChownExecutor {
399
399
Ok ( String :: new ( ) )
400
400
}
401
401
402
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
402
+ #[ cfg( target_os = "linux" ) ]
403
403
fn safe_dive_into < P : AsRef < Path > > ( & self , root : P ) -> i32 {
404
404
let root = root. as_ref ( ) ;
405
405
@@ -425,7 +425,7 @@ impl ChownExecutor {
425
425
ret
426
426
}
427
427
428
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
428
+ #[ cfg( target_os = "linux" ) ]
429
429
fn safe_traverse_dir ( & self , dir_fd : & DirFd , dir_path : & Path , ret : & mut i32 ) {
430
430
// Read directory entries
431
431
let entries = match dir_fd. read_dir ( ) {
@@ -530,7 +530,7 @@ impl ChownExecutor {
530
530
}
531
531
}
532
532
533
- #[ cfg( not( all ( target_os = "linux" , feature = "safe-traversal" ) ) ) ]
533
+ #[ cfg( not( target_os = "linux" ) ) ]
534
534
#[ allow( clippy:: cognitive_complexity) ]
535
535
fn dive_into < P : AsRef < Path > > ( & self , root : P ) -> i32 {
536
536
let root = root. as_ref ( ) ;
@@ -667,7 +667,7 @@ impl ChownExecutor {
667
667
}
668
668
669
669
/// Try to open directory with error reporting
670
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
670
+ #[ cfg( target_os = "linux" ) ]
671
671
fn try_open_dir ( & self , path : & Path ) -> Option < DirFd > {
672
672
DirFd :: open ( path)
673
673
. map_err ( |e| {
@@ -680,7 +680,7 @@ impl ChownExecutor {
680
680
681
681
/// Report ownership change with proper verbose output
682
682
/// Returns 0 on success
683
- #[ cfg( all ( target_os = "linux" , feature = "safe-traversal" ) ) ]
683
+ #[ cfg( target_os = "linux" ) ]
684
684
fn report_ownership_change_success (
685
685
& self ,
686
686
path : & Path ,
0 commit comments