From 653e1ff8bbd9307920cb933d4cb766179d3c3812 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 17 Feb 2012 18:59:10 +0100 Subject: bug fix in revert --- videomv.pl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'videomv.pl') diff --git a/videomv.pl b/videomv.pl index a96e62d..f45d463 100755 --- a/videomv.pl +++ b/videomv.pl @@ -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; -- cgit v1.2.3