From: Wolfram Schneider Date: Fri, 27 Jun 2014 09:36:17 +0000 (+0200) Subject: set CPU limit, in case the alarm handler will be ignored, MKWS-157 X-Git-Tag: 1.0.0~458^2~9 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=b0dabcd2993438c7326c44ee76da8c6bf67e8a37;p=mkws-moved-to-github.git set CPU limit, in case the alarm handler will be ignored, MKWS-157 --- diff --git a/test/bin/bomb.pl b/test/bin/bomb.pl index 6211eab..4ce8590 100755 --- a/test/bin/bomb.pl +++ b/test/bin/bomb.pl @@ -6,6 +6,7 @@ use Getopt::Long; use POSIX ":sys_wait_h"; +use BSD::Resource qw/setrlimit/; use strict; use warnings; @@ -38,6 +39,10 @@ my @system = @ARGV; die usage if $help; die usage if !@system; +# set CPU limit, in case the alarm handler will +# be ignored +setrlimit(RLIMIT_CPU, $timeout, 2*$timeout) or die "Cannot set CPU limit: $!\n"; + # # use fork/exec instead system() # @@ -54,4 +59,3 @@ if ($pid) { else { } 1; -