Skip to content

Commit fe2e38f

Browse files
committed
lscpu: make lookup() use more consistent [coverity scan]
We usually check lookup() return value. Let's do it in this case too. It seems static analyzers will be happy with consistent code. Signed-off-by: Karel Zak <kzak@redhat.com>
1 parent 2c864ba commit fe2e38f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

sys-utils/lscpu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,10 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
626626
read_physical_info_powerpc(desc);
627627

628628
if ((fp = ul_path_fopen(desc->procfs, "r", "sysinfo"))) {
629-
while (fgets(buf, sizeof(buf), fp) != NULL && !desc->machinetype)
630-
lookup(buf, "Type", &desc->machinetype);
629+
while (fgets(buf, sizeof(buf), fp) != NULL) {
630+
if (lookup(buf, "Type", &desc->machinetype))
631+
break;
632+
}
631633
fclose(fp);
632634
}
633635

0 commit comments

Comments
 (0)