the '.*' was greedy, also consuming all but one digits of the real percentage

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 PVE/Diskmanage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index abb90a7..e9036fe 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -134,7 +134,7 @@ sub get_smart_data {
                $smartdata->{text} = '' if !defined $smartdata->{text};
                $smartdata->{text} .= "$line\n";
                # extract wearout from nvme text, allow for decimal values
-               if ($line =~ m/Percentage Used:.*(\d+(?:\.\d+)?)\%/i) {
+               if ($line =~ m/Percentage Used:.*?(\d+(?:\.\d+)?)\%/i) {
                    $smartdata->{wearout} = 100 - $1;
                }
            } elsif ($line =~ m/SMART Disabled/) {
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to