diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-08-30 21:58:52 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-08-30 21:58:52 +0000 |
commit | 1372b186254cfe7e79eae83338558c7ac9743dce (patch) | |
tree | 4ca68c9e97badce30b544af64e7cc506c89eb8c2 /usr.sbin | |
parent | e4151ac77bfff748ed69b05d83111552f201c3e9 (diff) | |
download | FreeBSD-src-1372b186254cfe7e79eae83338558c7ac9743dce.zip FreeBSD-src-1372b186254cfe7e79eae83338558c7ac9743dce.tar.gz |
Use MACHINE_ARCH instead of MACHINE as the directory to fetch packages
from. Packages are architecture dependent, not machine dependent.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/add/main.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 762b61a..c8339db 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -22,7 +22,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/utsname.h> +#include <sys/sysctl.h> #include <err.h> #include <getopt.h> @@ -301,7 +301,9 @@ getpackagesite(void) { int reldate, i; static char sitepath[MAXPATHLEN]; - struct utsname u; + int archmib[] = { CTL_HW, HW_MACHINE_ARCH }; + char arch[64]; + size_t archlen = sizeof(arch); if (getenv("PACKAGESITE")) { if (strlcpy(sitepath, getenv("PACKAGESITE"), sizeof(sitepath)) @@ -324,8 +326,10 @@ getpackagesite(void) >= sizeof(sitepath)) return NULL; - uname(&u); - if (strlcat(sitepath, u.machine, sizeof(sitepath)) >= sizeof(sitepath)) + if (sysctl(archmib, 2, arch, &archlen, NULL, 0) == -1) + return NULL; + arch[archlen-1] = 0; + if (strlcat(sitepath, arch, sizeof(sitepath)) >= sizeof(sitepath)) return NULL; reldate = getosreldate(); |