[PATCH] lscpu: Fix regression caused by WSL detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 7572fb2b8cb69512ca230b7fcfa11577526843f4 introduced a failure on missing
/proc/sys/kernel/osrelease. Make it non-fatal to prevent crash in some chroot
environments.

Signed-off-by: Stanislav Brabec <sbrabec@xxxxxxx>
---
 sys-utils/lscpu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 318e93b43..1770872d5 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -917,9 +917,8 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 	FILE *fd;
 
 	/* We have to detect WSL first. is_vmware_platform() crashes on Windows 10. */
-
 	if (path_exist(_PATH_PROC_OSRELEASE)
-	    && (fd = path_fopen("r", 1, _PATH_PROC_OSRELEASE))) {
+	    && (fd = path_fopen("r", 0, _PATH_PROC_OSRELEASE))) {
 		char buf[256];
 
 		if (fgets(buf, sizeof(buf), fd) != NULL) {
-- 
2.11.0

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@xxxxxxxx
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux