From fc778c5d3970cfcd10c2e6820427b664f403aedf Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 5 May 2022 16:35:35 +0200 Subject: [statistics] Don't try to check MBR partition IDs for non-MBR drives Fixes #3908 --- modules-available/statistics/inc/hardwareparser.inc.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'modules-available/statistics') diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index 952abf91..16710a9f 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -515,11 +515,13 @@ class HardwareParser foreach (($dev['sfdisk']['partitiontable']['partitions'] ?? []) as $part) { if (!isset($part['size'])) continue; - $type = hexdec($part['type'] ?? '0'); - if ($type === 0x0 || $type === 0x5 || $type === 0xf || $type === 0x15 || $type === 0x1f - || $type === 0x85 || $type === 0xc5 || $type == 0xcf) { - // Extended partition, ignore - continue; + if ($table['partition_table'] === 'dos') { + $type = hexdec($part['type'] ?? '0'); + if ($type === 0x0 || $type === 0x5 || $type === 0xf || $type === 0x15 || $type === 0x1f + || $type === 0x85 || $type === 0xc5 || $type == 0xcf) { + // Extended partition, ignore + continue; + } } $used += $part['size'] * $fac; $id = 'part_' . $i . '_'; -- cgit v1.2.3-55-g7522