]> 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, 31 Jan 2017 12:44:43 +0000 (13:44 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c

index 0ba8154288e17ad22dfae9feeccf5c89edb8e3dd..318e93b4356da8baf71a221d256f96278b0ef09d 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) {