To: vim-dev@vim.org Subject: Patch 6.0.046 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.046 Problem: When getrlimit() returns an 8 byte number the check for running out of stack may fail. (Anthony Meijer) Solution: Skip the stack check if the limit doesn't fit in a long. Files: src/auto/configure, src/config.h.in, src/configure.in, src/os_unix.c *** ../vim60.45/src/auto/configure Fri Sep 28 17:39:10 2001 --- src/auto/configure Wed Oct 31 13:52:02 2001 *************** *** 5145,5158 **** fi echo $ac_n "checking for stack_t""... $ac_c" 1>&6 ! echo "configure:5151: checking for stack_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then echo "$ac_t""(cached) $ac_cv_type_stack_t" 1>&6 else cat > conftest.$ac_ext <&6 + echo "configure:5150: checking for rlim_t" >&5 + if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #if STDC_HEADERS + #include + #include + #endif + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_rlim_t=yes + else + rm -rf conftest* + ac_cv_type_rlim_t=no + fi + rm -f conftest* + + fi + echo "$ac_t""$ac_cv_type_rlim_t" 1>&6 + if test $ac_cv_type_rlim_t = no; then + cat >> confdefs.h <<\EOF + #define rlim_t unsigned long + EOF + + fi + echo $ac_n "checking for stack_t""... $ac_c" 1>&6 ! echo "configure:5184: checking for stack_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then echo "$ac_t""(cached) $ac_cv_type_stack_t" 1>&6 else cat > conftest.$ac_ext < doesn't define. */ #undef dev_t + /* Define to `unsigned long' if doesn't define. */ + #undef rlim_t + /* Define to `struct sigaltstack' if doesn't define. */ #undef stack_t *** ../vim60.45/src/configure.in Fri Sep 28 17:39:10 2001 --- src/configure.in Wed Oct 31 13:49:25 2001 *************** *** 1405,1410 **** --- 1405,1411 ---- AC_HEADER_TIME AC_CHECK_TYPE(ino_t, long) AC_CHECK_TYPE(dev_t, unsigned) + AC_CHECK_TYPE(rlim_t, unsigned long) AC_MSG_CHECKING(for stack_t) if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then *** ../vim60.45/src/os_unix.c Thu Oct 25 16:34:24 2001 --- src/os_unix.c Wed Oct 31 13:46:36 2001 *************** *** 428,433 **** --- 428,434 ---- struct rlimit rlp; if (getrlimit(RLIMIT_DATA, &rlp) == 0 + && rlp.rlim_cur < ((rlim_t)1 << (sizeof(long_u) * 8 - 1)) # ifdef RLIM_INFINITY && rlp.rlim_cur != RLIM_INFINITY # endif *************** *** 544,551 **** struct rlimit rlp; int i; ! /* Set the stack limit to 15/16 of the allowable size. */ if (getrlimit(RLIMIT_STACK, &rlp) == 0 # ifdef RLIM_INFINITY && rlp.rlim_cur != RLIM_INFINITY # endif --- 545,554 ---- struct rlimit rlp; int i; ! /* Set the stack limit to 15/16 of the allowable size. Skip this when the ! * limit doesn't fit in a long (rlim_cur might be "long long"). */ if (getrlimit(RLIMIT_STACK, &rlp) == 0 + && rlp.rlim_cur < ((rlim_t)1 << (sizeof(long_u) * 8 - 1)) # ifdef RLIM_INFINITY && rlp.rlim_cur != RLIM_INFINITY # endif *** ../vim60.45/src/version.c Wed Oct 31 11:56:35 2001 --- src/version.c Wed Oct 31 14:12:00 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 46, /**/ -- No man may purchase alcohol without written consent from his wife. [real standing law in Pennsylvania, United States of America] /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///