Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Extract OSMAJOR out of ABI instead of uname -r
Baptiste Daroussin committed 11 years ago
commit c04eed0cc0bd8562074ab0681540b22ede339fe3
parent 5d94a1a
1 file changed +6 -10
modified libpkg/pkg_config.c
@@ -658,18 +658,14 @@ bool
pkg_compiled_for_same_os_major(void)
{
#ifdef OSMAJOR
-
	struct utsname	u;
-
	int		osmajor;
+
	const char	*myabi;
+
	int		 osmajor;

-
	/* Are we running the same OS major version as the one we were
-
	 * compiled under? */
+
	myabi = pkg_object_string(pkg_config_get("ABI"));
+
	myabi = strchr(myabi,':');
+
	myabi++;

-
	if (uname(&u) != 0) {
-
		pkg_emit_error("Cannot determine OS version number");
-
		return (true);	/* Can't tell, so assume yes  */
-
	}
-

-
	osmajor = (int) strtol(u.release, NULL, 10);
+
	osmajor = (int) strtol(myabi, NULL, 10);

	return (osmajor == OSMAJOR);
#else