]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: make osrelease file optional
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2017 12:44:43 +0000 (13:44 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 21 Feb 2017 12:14:40 +0000 (13:14 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c

index 183fc8a49458b7051da19935bbe90ec62d418274..ec3dd4fd6a19f50523fe72c50ceaf7e71d475e19 100644 (file)
@@ -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) {