]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: don't use smbios when read snapshots
authorKarel Zak <kzak@redhat.com>
Wed, 30 Sep 2020 12:57:08 +0000 (14:57 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 30 Sep 2020 12:57:08 +0000 (14:57 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu.c
sys-utils/lscpu.h

index e6678441f46f5d07e52d82668110c1174348d4fc..20c7291e560ece134bcba60cce6e69e9dd75b401 100644 (file)
@@ -316,13 +316,14 @@ static int __arm_cpu_smbios(struct lscpu_desc *desc)
        return 0;
 }
 
-void arm_cpu_decode(struct lscpu_desc *desc)
+void arm_cpu_decode(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 {
        int rc = -1;
 
        /* use SMBIOS Type 4 data if available,
         * else fall back to manual decoding using the tables above */
-       if (access(_PATH_SYS_DMI_TYPE4, R_OK) == 0)
+       if (mod->system == SYSTEM_LIVE &&
+           access(_PATH_SYS_DMI_TYPE4, R_OK) == 0)
                rc = __arm_cpu_smbios(desc);
 
        if (rc)
index 90c475a1f47adaa4913796075f6ddf46f90e28bb..b7dc4dfb5fef25d3a851bc59800c1d9eab3ff485 100644 (file)
@@ -2475,7 +2475,7 @@ int main(int argc, char *argv[])
 
        read_nodes(desc);
        read_hypervisor(desc, mod);
-       arm_cpu_decode(desc);
+       arm_cpu_decode(desc, mod);
 
        switch(mod->mode) {
        case OUTPUT_SUMMARY:
index c0c5bbfe156ea1f5c4a5705653c984889affe69c..3de0abcce14a686ce93ed688f4b5ff1159f83d0b 100644 (file)
@@ -209,7 +209,7 @@ struct lscpu_modifier {
 };
 
 extern int read_hypervisor_dmi(void);
-extern void arm_cpu_decode(struct lscpu_desc *desc);
+extern void arm_cpu_decode(struct lscpu_desc *desc, struct lscpu_modifier *mod);
 
 #define _PATH_SYS_DMI          "/sys/firmware/dmi/tables/DMI"
 #define _PATH_SYS_DMI_TYPE4    "/sys/firmware/dmi/entries/4-0/raw"