Fix warning when cache file doesn't exist

This commit is contained in:
Charles Pigott 2017-10-16 10:20:03 +01:00
parent c416be3eab
commit 49758fe8b0
1 changed files with 2 additions and 4 deletions

6
sanoid
View File

@ -487,11 +487,9 @@ sub getsnaps {
my $cache = '/var/cache/sanoidsnapshots.txt';
my @rawsnaps;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($cache);
my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($cache);
if ( $forcecacheupdate || (time() - $mtime) > $cacheTTL ) {
if ( $forcecacheupdate || ! -f $cache || (time() - $mtime) > $cacheTTL ) {
if (checklock('sanoid_cacheupdate')) {
writelock('sanoid_cacheupdate');
if ($args{'verbose'}) {