aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-05-27 13:55:07 -0700
committerPaul Eggert2016-05-27 13:55:25 -0700
commit4e182dce20bd09e38a69bdf637a3bf2a8bbfdc58 (patch)
tree1b07dda3054cbc3df51073747466ea613e78bbbb
parent9d356f62b3c24d9f2b2bc3831cf19e8351860a86 (diff)
downloademacs-4e182dce20bd09e38a69bdf637a3bf2a8bbfdc58.tar.gz
emacs-4e182dce20bd09e38a69bdf637a3bf2a8bbfdc58.zip
Port to platforms where rlim_max < 0
* src/emacs.c (main): Do not treat a negative rlim_max as a limit; this can happen if a special value like RLIM_INFINITY is negative.
-rw-r--r--src/emacs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/emacs.c b/src/emacs.c
index bdcebbe1637..b8ba86f7356 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -851,11 +851,14 @@ main (int argc, char **argv)
851 /* Round the new limit to a page boundary; this is needed 851 /* Round the new limit to a page boundary; this is needed
852 for Darwin kernel 15.4.0 (see Bug#23622) and perhaps 852 for Darwin kernel 15.4.0 (see Bug#23622) and perhaps
853 other systems. Do not shrink the stack and do not exceed 853 other systems. Do not shrink the stack and do not exceed
854 rlim_max. Don't worry about values like RLIM_INFINITY 854 rlim_max. Don't worry about exact values of
855 since in practice they are so large that the code does 855 RLIM_INFINITY etc. since in practice when they are
856 the right thing anyway. */ 856 nonnegative they are so large that the code does the
857 right thing anyway. */
857 long pagesize = getpagesize (); 858 long pagesize = getpagesize ();
858 newlim = min (newlim + pagesize - 1, rlim.rlim_max); 859 newlim += pagesize - 1;
860 if (0 <= rlim.rlim_max && rlim.rlim_max < newlim)
861 newlim = rlim.rlim_max;
859 newlim -= newlim % pagesize; 862 newlim -= newlim % pagesize;
860 863
861 if (pagesize <= newlim - lim) 864 if (pagesize <= newlim - lim)