diff options
author | justdave%syndicomm.com <> | 2001-06-07 04:17:39 +0000 |
---|---|---|
committer | justdave%syndicomm.com <> | 2001-06-07 04:17:39 +0000 |
commit | fe52fe9957ce904a57f856716046276e8db72697 (patch) | |
tree | e575106f65a0cc96003f955837cd69dda7b2fbcc /globals.pl | |
parent | e1417d77ee61c777ae414590c220fca0d8da3dca (diff) | |
download | bugs-fe52fe9957ce904a57f856716046276e8db72697.tar bugs-fe52fe9957ce904a57f856716046276e8db72697.tar.gz bugs-fe52fe9957ce904a57f856716046276e8db72697.tar.bz2 bugs-fe52fe9957ce904a57f856716046276e8db72697.tar.xz bugs-fe52fe9957ce904a57f856716046276e8db72697.zip |
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.pl | 23 |
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: $!"; + } + } } } |