void-packages/srcpkgs/lshw/patches/musl-long_bits.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

20 lines
646 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
--- a/src/core/abi.cc
+++ b/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);