From 9e75d473525446d0961a7567bcb8a1e672949df8 Mon Sep 17 00:00:00 2001 From: cassiopc Date: Sat, 20 Oct 2012 14:24:23 +0200 Subject: fixed team login issue, included empty default options in submission tab, included extra-packages and links in ICPC Linux --- boca-1.5.0/src/system/importxml.php | 62 +++++++++++++++++++++++++ boca-1.5.1/doc/changelog.txt | 8 +++- boca-1.5.1/doc/problemexamples/gen_examples.sh | 21 +++++++-- boca-1.5.1/src/fcontest.php | 2 +- boca-1.5.1/src/flog.php | 5 +- boca-1.5.1/src/scoretable.php | 55 ++++++++++++---------- boca-1.5.1/src/team/run.php | 8 +++- boca-1.5.1/tools/etc/icpc/becomeserver.sh | 10 ++++ boca-1.5.1/tools/etc/icpc/doclean.sh | 5 +- boca-1.5.1/tools/etc/icpc/installboca.sh | 26 +++++++++-- boca-1.5.1/tools/icpc.etc.tgz | Bin 8653 -> 9583 bytes boca-1.5.1/tools/installv2.sh | 40 ++++++++++++++-- boca-1.5.1/tools/safeexec.c | 22 ++++++--- 13 files changed, 215 insertions(+), 49 deletions(-) mode change 100644 => 100755 boca-1.5.1/doc/problemexamples/gen_examples.sh diff --git a/boca-1.5.0/src/system/importxml.php b/boca-1.5.0/src/system/importxml.php index 5fcaef3..71616c1 100644 --- a/boca-1.5.0/src/system/importxml.php +++ b/boca-1.5.0/src/system/importxml.php @@ -136,6 +136,68 @@ if(isset($_POST["Submit"])) { 'userlastlogout'=>-1, 'permitip'=>-1); + $ac['CLARREC']=array('site'=>-1 + 'user'=>-1, + 'number'=>-1, + 'problem'=>-1, + 'question'=>-1, + 'clarnumber'=>-1, + 'clardate'=>-1, + 'clardatediff'=>-1, + 'clardatediffans'=>-1, + 'claranswer'=>-1, + 'clarstatus'=>-1, + 'clarjudge'=>-1, + 'clarjudgesite'=>-1, + 'updatetime'=>-1); + $ac['RUNREC']=array('site'=>-1, + 'user'=>-1, + 'number'=>-1, + 'runnumber'=>-1, + 'problem'=>-1, + 'lang'=>-1, + 'filename'=>-1, + 'filepath'=>-1, + 'rundate'=>-1, + 'rundatediff'=>-1, + 'rundatediffans'=>-1, + 'runanswer'=>-1, + 'runstatus'=>-1, + 'runjudge'=>-1, + 'runjudgesite'=>-1, + 'runjudge1'=>-1, + 'runjudgesite1'=>-1, + 'runanswer1'=>-1, + 'runjudge2'=>-1, + 'runjudgesite2'=>-1, + 'runanswer2'=>-1, + 'autoip'=>-1, + 'autobegindate'=>-1, + 'autoenddate'=>-1, + 'autoanswer'=>-1, + 'autostdout'=>-1, + 'autostderr'=>-1, + 'updatetime'=>-1); + $ac['TASKREC']=array( + 'site'=>-1, + 'user'=>-1, + 'desc'=>-1, + 'number'=>-1, + 'tasknumber'=>-1, + 'color'=>-1, + 'colorname'=>-1, + 'updatetime'=>-1, + 'filename'=>-1, + 'filepath'=>-1, + 'sys'=>-1, + 'status'=>-1, + 'taskdate'=>-1, + 'taskdatediff'=>-1, + 'taskdatediffans'=>-1, + 'taskstaffnumber'=>-1, + 'taskstaffsite'=>-1); + + if(strtoupper(substr($ar,0,5)) != '' && isset($_POST['password']) && strlen($_POST['password'])>20) { echo "
Starting to create the contest
"; $str = strtok($ar," \n\t"); diff --git a/boca-1.5.1/doc/changelog.txt b/boca-1.5.1/doc/changelog.txt index 0aeab31..66fe703 100644 --- a/boca-1.5.1/doc/changelog.txt +++ b/boca-1.5.1/doc/changelog.txt @@ -1,5 +1,11 @@ version 1.5.1: -xxx/xx/xx: +2012/10/20: +- (ICPC Linux) fixed logging in issue after cleandisk.sh +- (ICPC Linux) inclusion of some (new) suggested packages and links +- updated safeexec (there was a timing issue between time-limit and run-time-error) +- updated installboca.sh to account for different install directories +- fix bug with the option that teams can't change their password. This was causing login problems. +- inclusion of per side problem table (useful for multi-sites). version 1.5.0: 2012/08/24 diff --git a/boca-1.5.1/doc/problemexamples/gen_examples.sh b/boca-1.5.1/doc/problemexamples/gen_examples.sh old mode 100644 new mode 100755 index e25f7e7..6f11671 --- a/boca-1.5.1/doc/problemexamples/gen_examples.sh +++ b/boca-1.5.1/doc/problemexamples/gen_examples.sh @@ -1,6 +1,17 @@ #!/bin/bash -rm -f keys.txt -../../src/private/createproblemzip.php abacaxi A.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt -../../src/private/createproblemzip.php bits B.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt -../../src/private/createproblemzip.php formiga C.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt -../../src/private/createproblemzip.php multas D.problem.zip password | grep -A2 "The following line" | tail -n1 >> keys.txt +if [ "$1" == "" ]; then + echo "CREATING FILES WITHOUT PASSWORDS" + for i in `ls`; do + if [ -d $i ]; then + cd $i; zip -r ../$i.zip .; cd -; + fi + done +else + echo "USING ARGUMENT AS PASSWORD" + rm -f keys.txt + for i in `ls`; do + if [ -d $i ]; then + ../../src/private/createproblemzip.php "$i" "$i.zip" "$1" | grep -A2 "The following line" | tail -n1 >> keys.txt + fi + done +fi diff --git a/boca-1.5.1/src/fcontest.php b/boca-1.5.1/src/fcontest.php index 23ce241..a698fd3 100644 --- a/boca-1.5.1/src/fcontest.php +++ b/boca-1.5.1/src/fcontest.php @@ -1205,7 +1205,7 @@ function DBNewUser($param, $c=null) { MSGError("Site $site does not exist"); return false; } - if($type=='team') $pass='!'.$pass; + if($type=='team' && $pass != myhash("")) $pass='!'.$pass; $sql = "insert into usertable (contestnumber, usersitenumber, usernumber, username, usericpcid, userfullname, " . "userdesc, usertype, userenabled, usermultilogin, userpassword, userpermitip) values " . "($contest, $site, $user, '$username', '$usericpcid', '$userfull', '$userdesc', '$type', '$enabled', " . diff --git a/boca-1.5.1/src/flog.php b/boca-1.5.1/src/flog.php index 56fdfed..e52e167 100644 --- a/boca-1.5.1/src/flog.php +++ b/boca-1.5.1/src/flog.php @@ -123,7 +123,7 @@ function DBLogInContest($name,$pass,$contest,$msg=true) { } $a = DBGetRow("select * from usertable where username='$name' and contestnumber=". $b["contestnumber"]." and " . - "usersitenumber=".$b["contestlocalsite"], 0, null, "DBLogIn(get user)"); + "usersitenumber=".$b["contestlocalsite"], 0, null, "DBLogIn(get user)"); if ($a == null) { if($msg) { LOGLevel("User $name tried to log in contest $contest but it does not exist.",2); @@ -131,12 +131,13 @@ function DBLogInContest($name,$pass,$contest,$msg=true) { } return false; } + $a = DBUserInfo($b["contestnumber"], $b["contestlocalsite"],$a['usernumber'],null,false); $_SESSION['usertable'] = $a; $p = myhash($a["userpassword"] . session_id()); $_SESSION['usertable']['userpassword'] = $p; if ($a["userpassword"] != "" && $p != $pass) { LOGLevel("User $name tried to log in contest $contest but password was incorrect.",2); - if($msg) MSGError("User does not exist or incorrect password."); + if($msg) MSGError("Incorrect password."); unset($_SESSION["usertable"]); return false; } diff --git a/boca-1.5.1/src/scoretable.php b/boca-1.5.1/src/scoretable.php index 0233e99..574b700 100644 --- a/boca-1.5.1/src/scoretable.php +++ b/boca-1.5.1/src/scoretable.php @@ -74,7 +74,7 @@ if(!ValidSession()) { $loc = $_SESSION["loc"]; if(!isset($detail)) $detail=true; if(!isset($final)) $final=false; -$scoredelay["admin"] = 1; +$scoredelay["admin"] = 2; $scoredelay["score"] = 30; $scoredelay["team"] = 30; $scoredelay["judge"] = 10; @@ -95,33 +95,38 @@ if(file_exists($scoretmp)) { } } +if($_SESSION["usertable"]["usertype"]=='score' || (isset($_GET["remote"]) && is_numeric($_GET["remote"]))) { + $remotedir = $_SESSION['locr'] . $ds . "private" . $ds . "remotescores"; + $destination = $remotedir . $ds ."scores.zip"; + if(is_writable($remotedir)) { + if($redo || !is_readable($destination)) { + if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) + ForceLoad("index.php"); + + $level=$s["sitescorelevel"]; + $data0 = array(); + if($level>0) { + list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"], + $_SESSION["usertable"]["usersitenumber"], 1, -1); + } + $ct=DBGetActiveContest(); + $localsite=$ct['contestlocalsite']; + $fname = $remotedir . $ds . "score_site" . $localsite . "_" . md5($_SERVER['HTTP_HOST']); + @file_put_contents($fname . ".tmp",base64_encode(serialize($data0))); + @rename($fname . ".tmp",$fname . ".dat"); + + if(@create_zip($remotedir,glob($remotedir . '/*.dat'),$destination)!==true) { + LOGError("Cannot create score zip file"); + } else { + @create_zip($remotedir,array(),$destination); + } + } + } +} + if(isset($_GET["remote"])) { if(is_numeric($_GET["remote"])) { if($_GET["remote"]==-42) { - $remotedir = $_SESSION['locr'] . $ds . "private" . $ds . "remotescores"; - $destination = $remotedir . $ds ."scores.zip"; - if($redo || !is_readable($destination)) { - if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) - ForceLoad("index.php"); - - $level=$s["sitescorelevel"]; - $data0 = array(); - if($level>0) { - list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"], - $_SESSION["usertable"]["usersitenumber"], 1, -1); - } - $ct=DBGetActiveContest(); - $localsite=$ct['contestlocalsite']; - $fname = $remotedir . $ds . "score_site" . $localsite . "_" . md5($_SERVER['HTTP_HOST']); - file_put_contents($fname . ".tmp",base64_encode(serialize($data0))); - rename($fname . ".tmp",$fname . ".dat"); - - if(create_zip($remotedir,glob($remotedir . '/*.dat'),$destination)!==true) { - LOGError("Cannot create score zip file"); - } else { - create_zip($remotedir,array(),$destination); - } - } echo file_get_contents($destination); } else { if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) diff --git a/boca-1.5.1/src/team/run.php b/boca-1.5.1/src/team/run.php index 51afc75..3879674 100644 --- a/boca-1.5.1/src/team/run.php +++ b/boca-1.5.1/src/team/run.php @@ -132,6 +132,7 @@ $strtmp .= "

To submit a program, just fill in the following f " \n". " \n". @@ -142,6 +143,7 @@ $strtmp .= " \n". " \n". " \n". @@ -157,8 +159,12 @@ $strtmp .= " \n". "
\n". " \n". diff --git a/boca-1.5.1/tools/etc/icpc/becomeserver.sh b/boca-1.5.1/tools/etc/icpc/becomeserver.sh index 33bebea..4de2084 100755 --- a/boca-1.5.1/tools/etc/icpc/becomeserver.sh +++ b/boca-1.5.1/tools/etc/icpc/becomeserver.sh @@ -95,6 +95,16 @@ for i in `ls /etc/postgresql/*/main/pg_hba.conf`; do echo "==> IF YOU HAVE MULTIPLE AUTOJUDGE MACHINES, WRITE ONE LINE FOR EACH IP ADDRESS THERE IN THE FILE <==" echo "############" echo "host bocadb bocauser 0/0 md5" >> $i + else + echo "############" + echo "IT SEEMS YOU ALREADY HAVE MODIFIED THE FILE $i WITH BOCA'S INFORMATION" + echo "I WOULD USE THE LINE:" + echo "" + echo -e "echo \"host bocadb bocauser 0/0 md5\" >> $i" + echo "" + echo "to give access to the database to other computers, but" + echo ">>> I'M NOT DOING IT -- PLEASE CHECK IT <<<" + echo "############" fi done diff --git a/boca-1.5.1/tools/etc/icpc/doclean.sh b/boca-1.5.1/tools/etc/icpc/doclean.sh index ea7d517..40b49c1 100755 --- a/boca-1.5.1/tools/etc/icpc/doclean.sh +++ b/boca-1.5.1/tools/etc/icpc/doclean.sh @@ -4,11 +4,11 @@ if [ -f /home/icpc/.cleandisk.sh ]; then rm -rf /home/icpc find /home -user icpc -delete if [ -x /usr/bin/makepasswd ]; then - pass=`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-` + pass=`echo -n icpc | /usr/bin/makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-` pass=\$`echo $pass` id -u icpc >/dev/null 2>/dev/null if [ $? != 0 ]; then - useradd -d /home/icpc -m -p "$pass" -s /bin/bash -g users icpc + useradd -d /home/icpc -k /etc/skel -m -p "$pass" -s /bin/bash -g users icpc else usermod -d /home/icpc -p "$pass" -s /bin/bash -g users icpc fi @@ -23,6 +23,7 @@ if [ ! -d /home/icpc ]; then mv /home/skel /home/icpc fi chown -R icpc.users /home/icpc +chmod -R u+rwx /home/icpc fi cd - >/dev/null exit 0 diff --git a/boca-1.5.1/tools/etc/icpc/installboca.sh b/boca-1.5.1/tools/etc/icpc/installboca.sh index 8f35e74..d1cb842 100755 --- a/boca-1.5.1/tools/etc/icpc/installboca.sh +++ b/boca-1.5.1/tools/etc/icpc/installboca.sh @@ -1,4 +1,8 @@ #!/bin/bash +if [ "`id -u`" != "0" ]; then + echo "Script must run as root" +fi + di=`date +%s` echo "===================================================" echo "=================== obtaining BOCA ===============" @@ -15,7 +19,7 @@ bocaver=`cat /tmp/.boca.tmp` else bocaver=$1 fi -echo "Looking for BOCA version $bocaver from http://www.ime.usp.br/~cassio/boca/" + if [ "$2" == "" ]; then basedir=/var/www else @@ -27,6 +31,16 @@ exit 1 fi fi +OK=y +read -p "I will install boca at $basedir is it correct (otherwise, run this script as: $0 $bocaver to choose the place) [Y/n]? " OK +if [ "$OK" == "y" -o "$OK" == "Y" ]; then +echo "Install directory is $basedir" +else +echo "Aborted" +exit 1 +fi + +echo "Looking for BOCA version $bocaver from http://www.ime.usp.br/~cassio/boca/" cd $basedir rm -f boca-$bocaver.tgz wget -O boca-$bocaver.tgz "http://www.ime.usp.br/~cassio/boca/download.php?filename=boca-$bocaver.tgz" @@ -55,7 +69,11 @@ echo "=================== EXTRACTING BOCA ===============" echo "=====================================================" OK=x -if [ -f boca-$bocaver.$di/src/private/conf.php ]; then +conffile=boca/src/private/conf.php +if [ ! -f $conffile ]; then +conffile=boca-$bocaver.$di/src/private/conf.php +fi +if [ -f $conffile ]; then echo "OLD CONFIG FILE EXISTS" OK=x while [ "$OK" != "y" -a "$OK" != "n" ]; do @@ -65,6 +83,8 @@ if [ -f boca-$bocaver.$di/src/private/conf.php ]; then if [ "$OK" == "n" ]; then echo "You probably need to update the new file boca-$bocaver/src/private/conf.php with the correct passwords - PLEASE CHECK IT - NOT DONE AUTOMATICALLY" fi +else + echo "OLD Config file not found -- you must set up the new private/conf.php file properly" fi apacheuser= @@ -83,7 +103,7 @@ chmod -R g+rx,u+rwx boca-$bocaver/ chmod 600 boca-$bocaver/src/private/*.php [ -f boca-$bocaver.$di/src/private/remotescores/otherservers ] && cp -f boca-$bocaver.$di/src/private/remotescores/otherservers boca-$bocaver/src/private/remotescores/otherservers if [ "$OK" == "y" ]; then - cp -f boca-$bocaver.$di/src/private/conf.php boca-$bocaver/src/private/conf.php + cp -f $conffile boca-$bocaver/src/private/conf.php fi chmod 700 boca-$bocaver/tools/*.sh diff --git a/boca-1.5.1/tools/icpc.etc.tgz b/boca-1.5.1/tools/icpc.etc.tgz index 97af0a4..4151601 100644 Binary files a/boca-1.5.1/tools/icpc.etc.tgz and b/boca-1.5.1/tools/icpc.etc.tgz differ diff --git a/boca-1.5.1/tools/installv2.sh b/boca-1.5.1/tools/installv2.sh index 03cbd29..85886b6 100755 --- a/boca-1.5.1/tools/installv2.sh +++ b/boca-1.5.1/tools/installv2.sh @@ -108,7 +108,7 @@ echo "=====================================================================" echo "================= installing packages needed by BOCA ===============" echo "=====================================================================" -apt-get -y install zenity apache2 eclipse-pde eclipse-rcp eclipse-platform eclipse-jdt eclipse emacs \ +apt-get -y install zenity apache2 eclipse-pde eclipse-rcp eclipse-platform eclipse-jdt eclipse-cdt eclipse emacs \ evince g++ gcc gedit scite libstdc++6 makepasswd manpages-dev mii-diag php5-cli php5-mcrypt openjdk-6-dbg \ php5 php5-pgsql postgresql postgresql-client postgresql-contrib quota sharutils default-jdk openjdk-6-doc \ vim-gnome geany geany-plugin-addons geany-plugin-gdb geany-plugins default-jre sysstat \ @@ -134,11 +134,45 @@ echo "==================================================================" echo "============= creating user icpc with password icpc =============" echo "==================================================================" +mkdir -p /etc/skel/Desktop/ +cat < /etc/skel/Desktop/javadoc.desktop +[Desktop Entry] +Version=1.5.1 +Name=Java API +Comment=Java API +Exec=firefox /usr/share/doc/openjdk-6-jre-headless/api/index.html +Terminal=false +Type=Application +EOF +cat < /etc/skel/Desktop/stldoc.desktop +[Desktop Entry] +Version=1.5.1 +Name=C++ STL +Comment=C++ STL +Exec=firefox /usr/share/doc/stl-manual/html/index.html +Terminal=false +Type=Application +EOF +cat < /etc/skel/Desktop/cppannotations.desktop +[Desktop Entry] +Version=1.5.1 +Name=C++ Annotations +Comment=C++ Annotations +Exec=firefox /usr/share/doc/c++-annotations/html/index.html +Terminal=false +Type=Application +EOF +cp /usr/share/applications/eclipse.desktop /etc/skel/Desktop/ +cp /usr/share/applications/gedit.desktop /etc/skel/Desktop/ +cp /usr/share/applications/emacs23.desktop /etc/skel/Desktop/ +cp /usr/share/applications/gnome-terminal.desktop /etc/skel/Desktop/ +chmod 755 /etc/skel/Desktop/*.desktop + pass=`echo -n icpc | makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-` pass=\$`echo $pass` id -u icpc >/dev/null 2>/dev/null if [ $? != 0 ]; then - useradd -d /home/icpc -m -p "$pass" -s /bin/bash -g users icpc + useradd -d /home/icpc -k /etc/skel -m -p "$pass" -s /bin/bash -g users icpc else usermod -d /home/icpc -p "$pass" -s /bin/bash -g users icpc echo "user icpc already exists" @@ -230,7 +264,7 @@ echo "====================== EXTRACTING CONFIG FILES ===============" tar -xkvzf /tmp/icpc.etc.tgz for i in \`tar tvzf /tmp/icpc.etc.tgz | awk '{ print \$6; }'\`; do chown root.root \$i - chmod o-w,u+x \$i + chmod o-w,u+rx \$i done EOF chmod 750 /etc/icpc/installscripts.sh diff --git a/boca-1.5.1/tools/safeexec.c b/boca-1.5.1/tools/safeexec.c index 0dfa867..33f16b7 100644 --- a/boca-1.5.1/tools/safeexec.c +++ b/boca-1.5.1/tools/safeexec.c @@ -32,6 +32,7 @@ pid_t child_pid; /* pid of the child process */ +double cpu_timeoutdouble = 5.0; struct rlimit cpu_timeout = {5,5}; /* max cpu time (seconds) */ struct rlimit max_nofile = {64,64}; /* max number of open files */ struct rlimit max_fsize = {128*MBYTE,128*MBYTE}; /* max filesize */ @@ -52,7 +53,7 @@ int killallproc; int bequiet; int checknchild; int user, group; -const char vers[] = "1.5.0"; +const char vers[] = "1.5.1"; #define BUFFSIZE 256 char curdir[BUFFSIZE], rootdir[BUFFSIZE], saida[BUFFSIZE], entrada[BUFFSIZE], erro[BUFFSIZE]; @@ -230,6 +231,8 @@ int testsystem(pid_t p, pid_t pp, int userid, int groupid, double memlim, double return ret; } +char timekill=0; + /* alarm handler */ void handle_alarm(int sig) { static int iter=0; @@ -241,6 +244,7 @@ void handle_alarm(int sig) { if(!bequiet) fprintf(stderr, "safeexec: timed-out (realtime) after %d seconds\n", real_timeout); fflush(stderr); + timekill=1; kill(child_pid,9); /* kill child */ exitandkill(3); } @@ -293,7 +297,7 @@ int main(int argc, char **argv) { int currun = 0; struct stat sstat; double dt; - + setvbuf(stderr, NULL, _IONBF, 0); entrada[0] = saida[0] = erro[0] = rootdir[0] = curdir[0] = 0; user = group = -1; allproc = 1; @@ -329,7 +333,8 @@ int main(int argc, char **argv) { break; case 'm': max_rss.rlim_max = max_rss.rlim_cur = KBYTE*atoi(optarg); break; - case 't': cpu_timeout.rlim_max = cpu_timeout.rlim_cur = atoi(optarg); + case 't': cpu_timeout.rlim_max = cpu_timeout.rlim_cur = 1 + ((int) atof(optarg)); + cpu_timeoutdouble = atof(optarg); break; case 'T': real_timeout = atoi(optarg); break; @@ -415,6 +420,8 @@ Use -U and -G for that, but you might need to have root privilegies.\n"); alarm(1); /* set alarm and wait for child execution */ signal(SIGALRM, handle_alarm); while(waitpid(child_pid, &status, 0) != child_pid) ; + if(timekill) exitandkill(3); + testsystem(child_pid,getpid(),allproc?user:-1,allproc?group:-1,max_data.rlim_max,max_rss.rlim_max); getrusage(RUSAGE_CHILDREN, &uso); @@ -424,12 +431,12 @@ Use -U and -G for that, but you might need to have root privilegies.\n"); // printf("system runnning time: %.4lf\n",uso.ru_stime.tv_sec+(double)uso.ru_stime.tv_usec/1000000.0); // printf("total runnning time: %.4lf\n",dt); - if (dt + EPSILON >= cpu_timeout.rlim_max) { + if (dt >= cpu_timeoutdouble) { // printf ("utsec=%d utusec=%d stsec=%d stusec=%d\n", uso.ru_utime.tv_sec, uso.ru_utime.tv_usec, uso.ru_stime.tv_sec, uso.ru_stime.tv_usec); if(!bequiet) - fprintf(stderr, "safeexec: timed-out (cputime) after %d seconds\n", (int) cpu_timeout.rlim_max); + fprintf(stderr, "safeexec: timed-out (cputime) after %.2lf seconds\n", cpu_timeoutdouble); fflush(stderr); -// fprintf(stdout, "timed-out (cputime) after %d seconds\n", (int) cpu_timeout.rlim_max); +// fprintf(stdout, "timed-out (cputime) after %d seconds\n", cpu_timeoutint); // fflush(stdout); exitandkill(3); } @@ -489,6 +496,9 @@ Use -U and -G for that, but you might need to have root privilegies.\n"); /* attempt to change the hard limits */ /*******Note that currently Linux does not support memory usage limits********/ + + cpu_timeout.rlim_max+=1; cpu_timeout.rlim_cur+=1; + if( setrlimit(RLIMIT_CPU, &cpu_timeout) || setrlimit(RLIMIT_DATA, &max_data) || setrlimit(RLIMIT_STACK, &max_data) || -- cgit v1.2.3