summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2017-01-31 13:44:43 +0100
committerKarel Zak2017-01-31 13:44:43 +0100
commit4dfc54b6b17386d68a621d6c7f4e341e8736340f (patch)
tree37e05fd72a4742239ee1c6fc17aa6b676e708361
parentMerge branch 'master' of https://github.com/Pedro-MC/util-linux (diff)
downloadkernel-qcow2-util-linux-4dfc54b6b17386d68a621d6c7f4e341e8736340f.tar.gz
kernel-qcow2-util-linux-4dfc54b6b17386d68a621d6c7f4e341e8736340f.tar.xz
kernel-qcow2-util-linux-4dfc54b6b17386d68a621d6c7f4e341e8736340f.zip
lscpu: make osrelease file optional
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--sys-utils/lscpu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 0ba815428..318e93b43 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -918,7 +918,8 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
/* We have to detect WSL first. is_vmware_platform() crashes on Windows 10. */
- if ((fd = path_fopen("r", 1, _PATH_PROC_OSRELEASE))) {
+ if (path_exist(_PATH_PROC_OSRELEASE)
+ && (fd = path_fopen("r", 1, _PATH_PROC_OSRELEASE))) {
char buf[256];
if (fgets(buf, sizeof(buf), fd) != NULL) {