* Apply patches from PLD distribution (pdksh-5.2.14-23.src.rpm) + pdksh-eval-segv.patch, fixes one more segfault bug + pdksh-rlimit_locks.patch, adds flocks support to ulimit. * c_ulimit.c: enclose all uses of RLIMIT_LOCKS with appropriate #ifdefs (closes: #307323). Index: pdksh-5.2.14/c_sh.c =================================================================== --- pdksh-5.2.14.orig/c_sh.c 2008-04-15 20:49:47.000000000 +0200 +++ pdksh-5.2.14/c_sh.c 2008-04-15 20:50:48.000000000 +0200 @@ -422,7 +422,8 @@ c_eval(wp) char **wp; { - register struct source *s; + register struct source *s,*olds=source; + int retval; if (ksh_getopt(wp, &builtin_opt, null) == '?') return 1; @@ -456,7 +457,9 @@ exstat = subst_exstat; } - return shell(s, FALSE); + retval=shell(s, FALSE); + source=olds; + return retval; } int Index: pdksh-5.2.14/c_ulimit.c =================================================================== --- pdksh-5.2.14.orig/c_ulimit.c 2008-04-15 20:46:56.000000000 +0200 +++ pdksh-5.2.14/c_ulimit.c 2008-04-15 20:50:48.000000000 +0200 @@ -111,6 +111,9 @@ #ifdef RLIMIT_SWAP { "swap(kbytes)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' }, #endif +#ifdef RLIMIT_LOCKS + { "flocks", RLIMIT, RLIMIT_LOCKS, RLIMIT_LOCKS, -1, 'L' }, +#endif { (char *) 0 } }; static char options[3 + NELEM(limits)]; @@ -189,7 +192,18 @@ for (l = limits; l->name; l++) { #ifdef HAVE_SETRLIMIT if (l->which == RLIMIT) { - getrlimit(l->gcmd, &limit); + int getreturn; + + getreturn=getrlimit(l->gcmd, &limit); +#ifdef RLIMIT_LOCKS + if ( getreturn < 0 ) { + if ( ( errno == EINVAL ) && + ( l->gcmd == RLIMIT_LOCKS ) ) { + limit.rlim_cur = RLIM_INFINITY; + limit.rlim_max = RLIM_INFINITY; + } + } +#endif if (how & SOFT) val = limit.rlim_cur; else if (how & HARD) @@ -225,11 +239,17 @@ if (how & HARD) limit.rlim_max = val; if (setrlimit(l->scmd, &limit) < 0) { - if (errno == EPERM) + if (errno == EPERM) { bi_errorf("exceeds allowable limit"); - else +#ifdef RLIMIT_LOCKS + } else if ( ( errno == EINVAL ) && + ( l->scmd == RLIMIT_LOCKS ) ) { + bi_errorf("unable to set it on the current kernel"); +#endif + } else { bi_errorf("bad limit: %s", strerror(errno)); + } return 1; } } else {