Skip to content

Commit

Permalink
Avoid disk_* warnings by checking path readability first
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgp committed May 28, 2022
1 parent 86368fb commit 7ce2bd4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Linfo/OS/Linux.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,13 @@ public function getMounts()
$mount[2] = stripcslashes($mount[2]);

// Get these
$size = @disk_total_space($mount[2]);
$free = @disk_free_space($mount[2]);
$used = $size != false && $free != false ? $size - $free : false;
if (is_readable($mount[2])) {
$size = disk_total_space($mount[2]);
$free = disk_free_space($mount[2]);
$used = $size != false && $free != false ? $size - $free : false;
}else{
$size = $free = $used = false;
}

// If it's a symlink, find out where it really goes.
// (using realpath instead of readlink because the former gives absolute paths)
Expand Down

0 comments on commit 7ce2bd4

Please sign in to comment.