Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
TR_FD_SETSIZE
Browse files Browse the repository at this point in the history
ChisBread committed May 4, 2022
1 parent 9ed19d2 commit 5bf0381
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libtransmission/fdlimit.c
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@
*
*/

#define TR_FD_SETSIZE 4096

#include <errno.h>
#include <inttypes.h>
#include <string.h>
@@ -32,7 +34,6 @@
**** Local Files
****
***/

static bool preallocate_file_sparse(tr_sys_file_t fd, uint64_t length, tr_error** error)
{
tr_error* my_error = NULL;
@@ -398,8 +399,11 @@ static void ensureSessionFdInfoExists(tr_session* session)
if (getrlimit(RLIMIT_NOFILE, &limit) == 0)
{
int const old_limit = (int)limit.rlim_cur;
#ifdef TR_FD_SETSIZE
int const new_limit = MIN(limit.rlim_max, TR_FD_SETSIZE);
#else
int const new_limit = MIN(limit.rlim_max, FD_SETSIZE);

#endif
if (new_limit != old_limit)
{
limit.rlim_cur = new_limit;

0 comments on commit 5bf0381

Please sign in to comment.