Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Aug 2010 21:58:53 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r212029 - head/usr.sbin/pkg_install/add
Message-ID:  <201008302158.o7ULwrgl008914@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Mon Aug 30 21:58:52 2010
New Revision: 212029
URL: http://svn.freebsd.org/changeset/base/212029

Log:
  Use MACHINE_ARCH instead of MACHINE as the directory to fetch packages
  from. Packages are architecture dependent, not machine dependent.

Modified:
  head/usr.sbin/pkg_install/add/main.c

Modified: head/usr.sbin/pkg_install/add/main.c
==============================================================================
--- head/usr.sbin/pkg_install/add/main.c	Mon Aug 30 21:33:33 2010	(r212028)
+++ head/usr.sbin/pkg_install/add/main.c	Mon Aug 30 21:58:52 2010	(r212029)
@@ -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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008302158.o7ULwrgl008914>