diff options
-rwxr-xr-x | cli/icevault | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/icevault b/cli/icevault index eb8c343..e0c2757 100755 --- a/cli/icevault +++ b/cli/icevault @@ -398,7 +398,11 @@ sub saveIdentityFile($$) { my $parent_dir = $filename =~ s/\/[^\/]+$//r; File::Path::make_path($parent_dir) unless -d $parent_dir; # create parent directories recursively - File::Copy::move($outfh->filename, $filename) or error "Can't move C<%s>: %s", $outfh->filename, $!; + unless (File::Copy::move($outfh->filename, $filename)){ + my $r = $!; + unlink $outfh->filename; + error "Can't move C<%s>: %s", $outfh->filename, $r; + } # TODO: git add $filename; git commit } @@ -854,7 +858,7 @@ elsif ($command eq 'edit') { } else { myprintf "Saving user changes for identity C<%s>", $id; - saveIdentityFile( $fh->filename, $filename); + saveIdentityFile($fh->filename, $filename); } } |