Skip to content

Commit

Permalink
use rlim_cur instead of rlim_max
Browse files Browse the repository at this point in the history
(it seems rlim_max is unreliable on some systems and anyway
 as a userspace program, not trying to raise the limit, we should
 honor the soft limit and not the hard one)
  • Loading branch information
xant committed Apr 14, 2014
1 parent e6ba756 commit a7dd03e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/iomux.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ iomux_create(int bufsize, int threadsafe)

struct rlimit rlim;
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
iomux->maxconnections = rlim.rlim_max;
iomux->maxconnections = rlim.rlim_cur;
} else {
fprintf(stderr, "Can't get the max number of filedescriptors: %s\n",
strerror(errno));
Expand Down

0 comments on commit a7dd03e

Please sign in to comment.