1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

avoid an extra comparison caused by macro expansion

This commit is contained in:
Mitchell Livingston 2009-12-21 22:03:19 +00:00
parent 25a023023f
commit a7245651f2

View file

@ -832,7 +832,8 @@ tr_fdSetPeerLimit( tr_session * session, int socketLimit )
const int NOFILE_BUFFER = 512;
const int open_max = sysconf( _SC_OPEN_MAX );
getrlimit( RLIMIT_NOFILE, &rlim );
rlim.rlim_cur = MIN( MAX( 1024, open_max ), rlim.rlim_max );
rlim.rlim_cur = MAX( 1024, open_max );
rlim.rlim_cur = MIN( rlim.rlim_cur, rlim.rlim_max );
setrlimit( RLIMIT_NOFILE, &rlim );
tr_dbg( "setrlimit( RLIMIT_NOFILE, %d )", (int)rlim.rlim_cur );
gFd->socketLimit = MIN( socketLimit, (int)rlim.rlim_cur - NOFILE_BUFFER );