Don't create a detail.work.work file when rerunning after
authornbk <nbk>
Sat, 10 Dec 2005 17:13:37 +0000 (17:13 +0000)
committernbk <nbk>
Sat, 10 Dec 2005 17:13:37 +0000 (17:13 +0000)
radsqlrelay was interrupted.

scripts/radsqlrelay

index 75cc91a..8fba8e4 100755 (executable)
@@ -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);