Skip to content

Commit

Permalink
workaround lack of POSIX compliance of FreeBSD
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@72147 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Feb 9, 2017
1 parent 866fed4 commit d42b03b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ int Rf_initialize_R(int ac, char **av)
limit is either unlimited or unrepresentable.
*/
rlim_t lim = rlim.rlim_cur;
#if defined(RLIM_SAVED_CUR) && defined(RLIM_SAVED_MAX)
if (lim == RLIM_SAVED_CUR || lim == RLIM_SAVED_MAX)
lim = RLIM_INFINITY;
#endif
if (lim != RLIM_INFINITY) R_CStackLimit = (uintptr_t) lim;
}
#if defined(HAVE_LIBC_STACK_END)
Expand Down Expand Up @@ -506,8 +508,10 @@ int R_GetFDLimit() {
*/
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
rlim_t lim = rlim.rlim_cur;
#if defined(RLIM_SAVED_CUR) && defined(RLIM_SAVED_MAX)
if (lim == RLIM_SAVED_CUR || lim == RLIM_SAVED_MAX)
lim = RLIM_INFINITY;
#endif
return (int)((lim > INT_MAX) ? INT_MAX : lim);
}
#endif
Expand Down

0 comments on commit d42b03b

Please sign in to comment.