File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,14 @@ fn main() {
75
75
76
76
// Also test directly calling pthread_setname to check its return value.
77
77
assert_eq ! ( set_thread_name( & cstr) , 0 ) ;
78
- // But with a too long name it should fail except:
79
- // * on FreeBSD where the function has no return, hence cannot indicate failure,
80
- // * on Android where prctl silently truncates the string.
81
- #[ cfg( not( any( target_os = "freebsd" , target_os = "android" ) ) ) ]
82
- assert_ne ! ( set_thread_name( & std:: ffi:: CString :: new( name) . unwrap( ) ) , 0 ) ;
78
+
79
+ if name. len ( ) >= 15 {
80
+ // But with a too long name it should fail except:
81
+ // * on FreeBSD where the function has no return, hence cannot indicate failure,
82
+ // * on Android where prctl silently truncates the string.
83
+ #[ cfg( not( all( target_os = "freebsd" , target_os = "android" ) ) ) ]
84
+ assert_ne ! ( set_thread_name( & std:: ffi:: CString :: new( name) . unwrap( ) ) , 0 ) ;
85
+ }
83
86
} ) ;
84
87
result. unwrap ( ) . join ( ) . unwrap ( ) ;
85
88
}
You can’t perform that action at this time.
0 commit comments