From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx> Now the first one of certain ambiguous tags wins. Alternatively to this patch we could have called free() before xstrdup(). Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx> --- sys-utils/lscpu.c | 3 ++- tests/expected/lscpu/lscpu-x86_64-64cpu | 2 +- tests/expected/lscpu/lscpu-x86_64-dell_e4310 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 3b338aa..36e36c9 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -353,7 +353,8 @@ lookup(char *line, char *pattern, char **value) char *p, *v; int len = strlen(pattern); - if (!*line) + /* don't re-fill already found tags, first one wins */ + if (!*line || *value) return 0; /* pattern */ diff --git a/tests/expected/lscpu/lscpu-x86_64-64cpu b/tests/expected/lscpu/lscpu-x86_64-64cpu index 17350e3..07990ea 100644 --- a/tests/expected/lscpu/lscpu-x86_64-64cpu +++ b/tests/expected/lscpu/lscpu-x86_64-64cpu @@ -13,7 +13,7 @@ Stepping: 6 CPU MHz: 1064.000 CPU max MHz: 1996.0000 CPU min MHz: 1064.0000 -BogoMIPS: 3989.44 +BogoMIPS: 3990.31 Virtualization: VT-x L1d cache: 32K L1i cache: 32K diff --git a/tests/expected/lscpu/lscpu-x86_64-dell_e4310 b/tests/expected/lscpu/lscpu-x86_64-dell_e4310 index 929cdf9..39ec32c 100644 --- a/tests/expected/lscpu/lscpu-x86_64-dell_e4310 +++ b/tests/expected/lscpu/lscpu-x86_64-dell_e4310 @@ -13,7 +13,7 @@ Stepping: 5 CPU MHz: 1199.000 CPU max MHz: 2667.0000 CPU min MHz: 1199.0000 -BogoMIPS: 5319.97 +BogoMIPS: 5319.92 Virtualization: VT-x L1d cache: 32K L1i cache: 32K -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html