From 427cc8532402e08eab0398d5797ff527e5017295 Mon Sep 17 00:00:00 2001 From: nbk Date: Sat, 10 Dec 2005 17:13:37 +0000 Subject: [PATCH] Don't create a detail.work.work file when rerunning after radsqlrelay was interrupted. --- scripts/radsqlrelay | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/radsqlrelay b/scripts/radsqlrelay index 75cc91a..8fba8e4 100755 --- a/scripts/radsqlrelay +++ b/scripts/radsqlrelay @@ -99,13 +99,15 @@ sub process_file($$) { my ($dbinfo, $path) = @_; - until (rename($path, $path.'.work')) { - if ($! == ENOENT) { - sleep(1); - return if $need_exit; - } else { - print STDERR "error: Couldn't move $path to $path.work: $!\n"; - exit 1; + unless (-e $path.'.work') { + until (rename($path, $path.'.work')) { + if ($! == ENOENT) { + sleep(1); + return if $need_exit; + } else { + print STDERR "error: Couldn't move $path to $path.work: $!\n"; + exit 1; + } } } @@ -172,10 +174,6 @@ connect_wait(\%dbinfo); my $path = shift @ARGV; -if (-e $path.'.work') { - process_file(\%dbinfo, $path.'.work'); -} - until ($need_exit) { process_file(\%dbinfo, $path); last if ($args{1} || $need_exit); -- 2.1.4