void-packages/srcpkgs/lshw/patches/musl-long_bits.patch
Érico Rolim a3ad5f698a lshw: clean up musl patches.
musl-path_max was no longer necessary, and musl-confname_h was kind of
helping them do the wrong thing. They should just be using the value of
LONG_BIT instead of trying to pass it to sysconf, so the usage was wrong
on glibc and musl. _SC_LONG_BIT is a glibc extension and shouldn't be at
all needed.

Since this does change behavior (sysconf(LONG_BIT) could return
arbitrary values), revbump the package.
2021-01-12 00:04:51 -03:00

20 lines
642 B
Diff

sysconf(LONG_BIT) isn't correct usage of sysconf(3).
musl doesn't define _SC_LONG_BIT, so just use LONG_BIT directly. There's really
no reason to use sysconf(3) here, word size isn't a runtime property.
diff --git src/core/abi.cc src/core/abi.cc
index adff7b5..76c664c 100644
--- src/core/abi.cc
+++ src/core/abi.cc
@@ -20,9 +20,7 @@ __ID("@(#) $Id: mem.cc 1352 2006-05-27 23:54:13Z ezix $");
bool scan_abi(hwNode & system)
{
// are we compiled as 32- or 64-bit process ?
- long sc = sysconf(LONG_BIT);
- if(sc==-1) sc = sysconf(_SC_LONG_BIT);
- if(sc!=-1) system.setWidth(sc);
+ system.setWidth(LONG_BIT);
pushd(PROC_SYS);