summaryrefslogtreecommitdiffstats
path: root/globals.pl
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2001-06-07 06:17:39 +0200
committerjustdave%syndicomm.com <>2001-06-07 06:17:39 +0200
commitfe52fe9957ce904a57f856716046276e8db72697 (patch)
treee575106f65a0cc96003f955837cd69dda7b2fbcc /globals.pl
parente1417d77ee61c777ae414590c220fca0d8da3dca (diff)
downloadbugzilla-fe52fe9957ce904a57f856716046276e8db72697.tar.gz
bugzilla-fe52fe9957ce904a57f856716046276e8db72697.tar.xz
Fix for bug 21253: removing all single-parameter system() calls from Bugzilla
Patch by Dave Miller <justdave@syndicomm.com> r= tara@tequilarista.org
Diffstat (limited to 'globals.pl')
-rw-r--r--globals.pl23
1 files changed, 21 insertions, 2 deletions
diff --git a/globals.pl b/globals.pl
index e81363673..8d539f035 100644
--- a/globals.pl
+++ b/globals.pl
@@ -109,8 +109,27 @@ sub ReconnectToShadowDatabase {
my $shadowchanges = 0;
sub SyncAnyPendingShadowChanges {
if ($shadowchanges) {
- system("./syncshadowdb &");
- $shadowchanges = 0;
+ my $pid;
+ FORK: {
+ if ($pid = fork) { # create a fork
+ # parent code runs here
+ $shadowchanges = 0;
+ return;
+ } elsif (defined $pid) {
+ # child process code runs here
+ exec("./syncshadowdb",[]) or die "Unable to exec syncshadowdb: $!";
+ # passing the empty list as a second parameter tricks it into
+ # using execvp instead of running a shell, but still doesn't
+ # pass any parameters to syncshadowdb
+ } elsif ($! =~ /No more process/) {
+ # recoverable fork error, try again in 5 seconds
+ sleep 5;
+ redo FORK;
+ } else {
+ # something weird went wrong
+ die "Can't create background process to run syncshadowdb: $!";
+ }
+ }
}
}