diff options
-rwxr-xr-x | videomv.pl | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -539,21 +539,24 @@ else { my $old_tar; if (defined $old_symlink) { $old_tar = readlink $old_symlink; - &perform ("Deleting old symlink... ", unlink $old_symlink); + &perform ("Deleting old symlink... ", unlink $old_symlink) unless $r; } -opendir my $DIR, catdir($directors, $old_director) or die "Can't open: $!"; -if (scalar(grep(!/^\.\.?$/, readdir $DIR) == 0)) { - &perform ("Removing empty dir... ", rmdir catdir($directors, $old_director)); +unless ($r) { + opendir my $DIR, catdir($directors, $old_director) or die "Can't open: $!"; + if (scalar(grep(!/^\.\.?$/, readdir $DIR) == 0)) { + &perform ("Removing empty dir... ", rmdir catdir($directors, $old_director)); + } + closedir $DIR or die "Can't close: $!"; } -closedir $DIR or die "Can't close: $!"; &perform ("Creating new symlink... ", symlink catfile(updir(),'DIRECTORS',$new_director,$new_filename), - $new_symlink); + $new_symlink) + unless $r; -unless (defined $ignoredb_flag || $old_filename eq $new_filename) { +unless ($r || defined ($ignoredb_flag) || $old_filename eq $new_filename) { print LOG "Updating database... "; if ($nRES == 0) { $r = 2; @@ -600,8 +603,6 @@ sub ack { # Perform the given action; revert successful changes in case of failing sub perform { - return if $r; - my ($action,$test) = @_; print LOG $action; |