mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2024-12-23 17:34:34 +03:00
file_size_info: handle dangling symlinks
and other stat failure modes. this method returns undef if 'qemu-img info ...' fails to return information, so callers must handle this already. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
c018887fd3
commit
d1f4700063
@ -783,6 +783,12 @@ sub file_size_info {
|
||||
|
||||
my $st = File::stat::stat($filename);
|
||||
|
||||
if (!defined($st)) {
|
||||
my $extramsg = -l $filename ? ' - dangling symlink?' : '';
|
||||
warn "failed to stat '$filename'$extramsg\n";
|
||||
return undef;
|
||||
}
|
||||
|
||||
if (S_ISDIR($st->mode)) {
|
||||
return wantarray ? (0, 'subvol', 0, undef, $st->ctime) : 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user