]> git.proxmox.com Git - pve-common.git/commitdiff
memory info: add regex anchor to avoid false positives
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 17 Apr 2023 14:15:06 +0000 (16:15 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 26 Apr 2023 10:20:33 +0000 (12:20 +0200)
if arcstat gets re-ordered or new field that includes 'size' gets
added at the top

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/ProcFSTools.pm

index 43ba49030aad9b232fca9914926c145fc20d28f7..f5677b75d0f6a468b605a3ff908452ea84683d95 100644 (file)
@@ -309,7 +309,7 @@ sub read_meminfo {
     $res->{memshared} = int($spages) * 4096;
 
     my $arc_stats = eval { PVE::Tools::file_get_contents("/proc/spl/kstat/zfs/arcstats") };
-    if ($arc_stats && $arc_stats =~ m/size\s+\d+\s+(\d+)/m) {
+    if ($arc_stats && $arc_stats =~ m/^size\s+\d+\s+(\d+)$/m) {
        $res->{arcsize} = int($1);
     }