Commit 82a704a 1 parent 6563803 commit 82a704a Copy full SHA for 82a704a
File tree 1 file changed +9
-7
lines changed
src/tools/compiletest/src
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,16 @@ pub unsafe fn raise_fd_limit() {
57
57
panic ! ( "raise_fd_limit: error calling getrlimit: {}" , err) ;
58
58
}
59
59
60
- // Bump the soft limit to the smaller of kern.maxfilesperproc and the hard
61
- // limit
62
- rlim. rlim_cur = cmp:: min ( maxfiles as libc:: rlim_t , rlim. rlim_max ) ;
60
+ // Make sure we're only ever going to increase the rlimit.
61
+ if rlim. rlim_cur < maxfiles as libc:: rlim_t {
62
+ // Bump the soft limit to the smaller of kern.maxfilesperproc and the hard limit.
63
+ rlim. rlim_cur = cmp:: min ( maxfiles as libc:: rlim_t , rlim. rlim_max ) ;
63
64
64
- // Set our newly-increased resource limit
65
- if libc:: setrlimit ( libc:: RLIMIT_NOFILE , & rlim) != 0 {
66
- let err = io:: Error :: last_os_error ( ) ;
67
- panic ! ( "raise_fd_limit: error calling setrlimit: {}" , err) ;
65
+ // Set our newly-increased resource limit.
66
+ if libc:: setrlimit ( libc:: RLIMIT_NOFILE , & rlim) != 0 {
67
+ let err = io:: Error :: last_os_error ( ) ;
68
+ panic ! ( "raise_fd_limit: error calling setrlimit: {}" , err) ;
69
+ }
68
70
}
69
71
}
70
72
You can’t perform that action at this time.
0 commit comments