uname: switch machine to HW_MACHINE_ARCH

On powerpc64, powerpc64le and riscv64 some software wrongly assumes that
it runs on powerpc or riscv (32-bit).

Differential revision:	https://reviews.freebsd.org/D35962
Approved by:	alfredo, imp
This commit is contained in:
Piotr Kubaj 2022-12-11 04:01:44 +01:00
parent 0ef861e6f4
commit 83bf6ab568

View File

@ -127,11 +127,11 @@ __xuname(int namesize, void *namebuf)
}
q += namesize;
if ((p = getenv("UNAME_m")))
if ((p = getenv("UNAME_p")))
strlcpy(q, p, namesize);
else {
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
mib[1] = HW_MACHINE_ARCH;
len = namesize;
oerrno = errno;
if (sysctl(mib, 2, q, &len, NULL, 0) == -1) {