* Fix ulimit parameters for wfShellExec when memory_limit is specified in 'm'

With memory_limit of '50M', it got automatically turned into '50' in a
numeric context, which ended up passing *zero* kilobytes for ulimit.
This would make nothing able to run on Linux, things would just segfault.
This commit is contained in:
Brion Vibber 2005-11-26 20:17:43 +00:00
parent e0f1f62e1c
commit 5536dcb1f7
2 changed files with 5 additions and 0 deletions

View file

@ -254,6 +254,8 @@ fully support the editing toolbar, but was found to be too confusing.
* Changed mail form to have a bigger message entry box (like for editing
a page
* Support <includeonly> in templates loaded through preload= parameter
* Fix ulimit parameters for wfShellExec when memory_limit is specified in 'm'
=== Caveats ===

View file

@ -1588,6 +1588,9 @@ function wfShellExec( $cmd )
if ( php_uname( 's' ) == 'Linux' ) {
$time = ini_get( 'max_execution_time' );
$mem = ini_get( 'memory_limit' );
if( preg_match( '/^([0-9]+)[Mm]$/', trim( $mem ), $m ) ) {
$mem = intval( $m[1] * (1024*1024) );
}
if ( $time > 0 && $mem > 0 ) {
$script = "$IP/bin/ulimit.sh";
if ( is_executable( $script ) ) {