File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 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() {
5757 panic ! ( "raise_fd_limit: error calling getrlimit: {}" , err) ;
5858 }
5959
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 ) ;
6364
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+ }
6870 }
6971}
7072
You can’t perform that action at this time.
0 commit comments