Fix old stat() code and support stat_mode

This commit is contained in:
2019-06-13 02:24:23 -07:00
parent 30f646f141
commit 4f1ef015b3

View File

@@ -435,17 +435,24 @@ foreach ($files as $splFileInfo) {
}
// capture stat before values change
// Collect file stat()
if ($splFileInfo->getType() != "link") {
$stx[$i] = array( $splFileInfo->getATime(),
$splFileInfo->getMTime(),
$splFileInfo->getCTime() );
}
if ($p['stat_mode']) {
$sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
//$sty[$i] = "bypass";
$sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
if ($p['stat_mode'] > 1 && $splFileInfo->getType() != "link") {
// capture stat values for postflight comparison
$stx[$i] = array($splFileInfo->getATime(), $splFileInfo->getMTime(), $splFileInfo->getCTime());
}
} else {
$sty[$i] = "bypass";
}
// Check file can be read
@@ -1168,13 +1175,13 @@ foreach ($files as $splFileInfo) {
// Double check stat for file against pre-run value
if ($p['verify_stat'] && $type != "link") {
if ($p['stat_mode'] > 1 && $type != "link") {
$restat = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
$message = array();
if ($sty[$j]['st_atime'] != $restat['st_atime']) {
if ($p['fixatimes'] && $type != "link" && is_writable($pathname)) {
if ($p['stat_mode'] == 3 && is_writable($pathname)) {
exec("touch -at `date -r ".$sty[$j]['st_atime']." +%Y%m%d%H%M.%S` ".$shellpath." 2>&1");
$message[] = "atime (fix)";
} else {