File lscpu-fix-parameter-order-for-ul_prefix_fopen.patch of Package util-linux.34260
From: "Tom Abraham" <tabraham@suse.com>
Subject: Fix incorrect parameter order for ul_prefix_fopen when reading hypervisor features
Reference: bsc#1215918
Git-mainline: never, upstream rewrote this code in v2.40
For some reason, this code uses ul_prefix_fopen instead of ul_path_fopen and
has a different parameter order.
Incorrect order of parameters passed to ul_prefix_fopen when reading
/sys/hypervisor/properties/features results in a silent failure and
possible misidentification.
The function as defined in include/path.h is:
FILE *ul_prefix_fopen(const char *prefix, const char *path, const char *mode);
In later changes, this code was moved from lscpu.c to lscpu-virt.c and
commit 8e58a3f11d ("lib/path: remove ul_prefix_fopen") changed this to use
ul_path_fopen in v2.40-rc1
This is a simpler backport of that fix.
--- a/sys-utils/lscpu.c.orig
+++ b/sys-utils/lscpu.c
@@ -939,7 +939,7 @@ read_hypervisor(struct lscpu_desc *desc,
if (desc->hyper == HYPER_XEN) {
uint32_t features;
- fd = ul_prefix_fopen(desc->prefix, "r", _PATH_SYS_HYP_FEATURES);
+ fd = ul_prefix_fopen(desc->prefix, _PATH_SYS_HYP_FEATURES, "r");
if (fd && fscanf(fd, "%x", &features) == 1) {
/* Xen PV domain */