Use eval "$4" instead of "$@", so that shell metacharacters such as "(" are understood
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 24 Apr 2007 18:09:53 +0000 (18:09 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 24 Apr 2007 18:09:53 +0000 (18:09 +0000)
bin/ulimit4.sh [new file with mode: 0755]
includes/GlobalFunctions.php

diff --git a/bin/ulimit4.sh b/bin/ulimit4.sh
new file mode 100755 (executable)
index 0000000..2a840d2
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+ulimit -t $1 -v $2 -f $3
+eval "$4"
index 291224b..1ffde74 100644 (file)
@@ -1820,14 +1820,14 @@ function wfShellExec( $cmd, &$retval=null ) {
        }
 
        if ( php_uname( 's' ) == 'Linux' ) {
-               $time = ini_get( 'max_execution_time' );
+               $time = intval( ini_get( 'max_execution_time' ) );
                $mem = intval( $wgMaxShellMemory );
                $filesize = intval( $wgMaxShellFileSize );
 
                if ( $time > 0 && $mem > 0 ) {
-                       $script = "$IP/bin/ulimit-tvf.sh";
+                       $script = "$IP/bin/ulimit4.sh";
                        if ( is_executable( $script ) ) {
-                               $cmd = escapeshellarg( $script ) . " $time $mem $filesize $cmd";
+                               $cmd = escapeshellarg( $script ) . " $time $mem $filesize " . escapeshellarg( $cmd );
                        }
                }
        } elseif ( php_uname( 's' ) == 'Windows NT' ) {