Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
osversion: fix comparison
Baptiste Daroussin committed 1 year ago
commit 967516902f4923994c6344a97250a920db9018d5
parent 74f7b91
3 files changed +5 -6
modified libpkg/pkg_config.c
@@ -83,13 +83,13 @@ struct pkg_ctx ctx = {
	.pkg_dbdirfd = -1,
	.pkg_reposdirfd = -1,
	.devnullfd = -1,
-
	.osversion = 0,
	.backup_libraries = false,
	.triggers = true,
	.compression_format = NULL,
	.compression_level = -1,
	.compression_threads = -1,
	.defer_triggers = false,
+
	.oi = NULL,
};

struct config_entry {
modified libpkg/private/pkg.h
@@ -166,7 +166,6 @@ struct pkg_ctx {
	int dbdirfd;
	int pkg_dbdirfd;
	int pkg_reposdirfd;
-
	int osversion;
	bool archive_symlink;
	bool backup_libraries;
	const char *backup_library_path;
modified libpkg/utils.c
@@ -377,8 +377,8 @@ is_valid_os_version(struct pkg *pkg)
			    fbsd_version, pkg->name);
			return (false);
		}
-
		if (fbsdver > ctx.osversion) {
-
			if (fbsdver - ctx.osversion < 100000) {
+
		if (fbsdver > ctx.oi->osversion) {
+
			if (fbsdver - ctx.oi->osversion < 100000) {
				/* Negligible difference, ask user to enforce */
				if (osver_mismatch_allowed == -1) {
					snprintf(query_buf, sizeof(query_buf),
@@ -387,7 +387,7 @@ is_valid_os_version(struct pkg *pkg)
							"- package: %d\n"
							"- running userland: %d\n"
							"Ignore the mismatch and continue? ", pkg->name,
-
							fbsdver, ctx.osversion);
+
							fbsdver, ctx.oi->osversion);
					ret = pkg_emit_query_yesno(false, query_buf);
					osver_mismatch_allowed = ret;
				}
@@ -400,7 +400,7 @@ is_valid_os_version(struct pkg *pkg)
					"- package: %d\n"
					"- running kernel: %d\n",
					pkg->name,
-
					fbsdver, ctx.osversion);
+
					fbsdver, ctx.oi->osversion);
				return (false);
			}
		}