Csistck
view release on metacpan or search on metacpan
lib/Csistck/Test/FileBase.pm view on Meta::CPAN
if ($fh) {
my $curuid = $fh->uid;
debug("File owner: file=<$file> uid=<$uid>");
}
return ($curuid == $uid);
}
sub uid_repair {
my ($file, $uid) = @_;
debug("Chown file: file=<$file> uid=<$uid>");
chown($uid, -1, $file);
}
# GID operations
sub gid_check {
my ($file, $gid) = @_;
my $fh = stat($file);
my $curgid = undef;
if ($fh) {
$curgid = $fh->gid;
debug("File group: file=<$file> gid=<$gid>");
}
return ($curgid == $gid);
}
sub gid_repair {
my ($file, $gid) = @_;
debug("Chown file: file=<$file> gid=<$gid>");
chown(-1, $gid, $file);
}
# Compare hashes between two files
sub file_compare {
my @files = @_;
return 0 unless (scalar @files == 2);
# Get hashes and return compare
my ($hasha, $hashb) = map hash_file($_), @files;
debug(sprintf "File compare result: <hash=%s> <hash=%s>", $hasha, $hashb);
( run in 0.767 second using v1.01-cache-2.11-cpan-71847e10f99 )