btrbk: fix @stderr propagation from vinfo_init_root

As we print @stderr in warnings if vinfo_init_root() function fails,
we need to make sure that @stderr contains sane values.

Clearing @stderr is required when calling caching functions!
pull/334/head
Axel Burri 2019-12-15 18:47:27 +01:00
parent 67d24695f1
commit 631a4c30fe
1 changed files with 2 additions and 0 deletions

2
btrbk
View File

@ -2626,10 +2626,12 @@ sub vinfo_init_root($)
my $vol = shift || die;
# resolve btrfs tree from mount point
@stderr = (); # clear @stderr (propagated for logging)
my ($mnt_path, $real_path, $subvolid, $mount_source, $mountpoints) = btrfs_mountpoint($vol);
return undef unless($mnt_path && $real_path && $subvolid);
# read btrfs tree for the mount point
@stderr = (); # clear @stderr (propagated for logging)
my $mnt_vol = vinfo($vol->{URL_PREFIX} . $mnt_path, $vol->{CONFIG});
my $mnt_tree_root = btr_tree($mnt_vol, $subvolid, $mount_source, $mountpoints);
return undef unless($mnt_tree_root);