summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-10-27 20:15:53 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-10-27 20:15:53 +0000
commitb7e05bb315f3e76124f6a8ef1cb09f7f8e0be018 (patch)
tree8a69c9659ba3573c881d1b04db4e0b8ceffe9238
parentbbc7915f36c38f974ebd61ce4dbdad4995f2ba69 (diff)
Improvments to valdebug-unattended [danieldg]
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10727 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--.inspircd.inc15
1 files changed, 12 insertions, 3 deletions
diff --git a/.inspircd.inc b/.inspircd.inc
index 781e745af..b0933f07d 100644
--- a/.inspircd.inc
+++ b/.inspircd.inc
@@ -177,11 +177,20 @@ sub valdebugunattended
# NOTE: Saving the debug log (redirected stdout), while useful, is a potential security risk AND one hell of a spacehog. DO NOT SAVE THIS WHERE EVERYONE HAS ACCESS!
# Redirect stdout to /dev/null if you're worried about the security.
#
- # Note the & at the end. We *must* detach otherwise the script hangs.
- system("valgrind -v --tool=memcheck --leak-check=yes --num-callers=10 --time-stamp=yes --log-file=$valgrindlogpath/valdebug.%p $binpath/$executable -nofork -debug -nolog >> $basepath/valdebug.insp.out &");
+ my $pid = fork;
+ if ($pid == 0) {
+ POSIX::setsid();
+ umask 066;
+ open STDIN, '/dev/null' or die $!;
+ open STDOUT, '>', "$valgrindlogpath/out.$$" or die $!;
+ open STDERR, '>', "$valgrindlogpath/err.$$" or die $!;
+ umask 022;
+ exec "valgrind -v --tool=memcheck --leak-check=yes --num-callers=10 --time-stamp=yes --log-file=$valgrindlogpath/valdebug.\%p $binpath/$executable -nofork -debug -nolog";
+ exit 1;
+ }
# Sleep 5 seconds to give valgrind time to initialize before chmodding the logdir for apache access.
sleep(5);
- system("chmod 644 $valgrindlogpath/*");
+ system("chmod 644 $valgrindlogpath/valdebug.*");
}
sub screenvaldebug