File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,20 +233,22 @@ fn test_chmod_ugoa() {
233233}
234234
235235#[ test]
236- #[ cfg( any ( target_os = "linux" , target_os = "macos" , target_os = "android" ) ) ]
236+ #[ cfg( unix ) ]
237237#[ allow( clippy:: cast_lossless) ]
238238fn test_chmod_umask_expected ( ) {
239- // Get the actual system umask using libc
240- let system_umask = unsafe {
241- let mask = libc:: umask ( 0 ) ;
242- libc:: umask ( mask) ;
239+ // Get the actual system umask
240+ let system_umask = {
241+ use rustix:: process:: umask;
242+ let mask = umask ( rustix:: fs:: Mode :: empty ( ) ) ;
243+ umask ( mask) ;
243244 mask
244245 } ;
245246
246247 // Now verify that get_umask() returns the same value
247248 let current_umask = uucore:: mode:: get_umask ( ) ;
248249 assert_eq ! (
249- current_umask, system_umask as u32 ,
250+ current_umask,
251+ system_umask. bits( ) as u32 ,
250252 "get_umask() returned {current_umask:03o}, but system umask is {system_umask:03o}" ,
251253 ) ;
252254}
You can’t perform that action at this time.
0 commit comments