base plugin: add ctime for all files

Creation time makes sense for other file types also.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2020-03-04 11:46:20 +01:00
committed by Thomas Lamprecht
parent 545e127e52
commit ff9c5451a5

View File

@ -3,6 +3,7 @@ package PVE::Storage::Plugin;
use strict; use strict;
use warnings; use warnings;
use Fcntl ':mode';
use File::chdir; use File::chdir;
use File::Path; use File::Path;
use File::Basename; use File::Basename;
@ -904,7 +905,11 @@ my $get_subdir_files = sub {
foreach my $fn (<$path/*>) { foreach my $fn (<$path/*>) {
next if -d $fn; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($fn);
next if S_ISDIR($mode);
my $info; my $info;
@ -943,7 +948,8 @@ my $get_subdir_files = sub {
}; };
} }
$info->{size} = -s $fn // 0; $info->{size} = $size;
$info->{ctime} //= $ctime;
push @$res, $info; push @$res, $info;
} }