Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Issue #396: Emit a relevant error message when EUID doesn't have sufficient privilege to update repo.sqlite and that has been requested (ie pkg version -R)
Matthew Seaman committed 13 years ago
commit a81b470260ed0ff6504b4993c7293732c4cf1426
parent c49844c
2 files changed +11 -0
modified libpkg/pkg.h.in
@@ -411,6 +411,10 @@ typedef enum {
	 * repo DB schema incompatible version
	 */
	EPKG_REPOSCHEMA,
+
	/**
+
         * Insufficient privilege for action
+
         */
+
	EPKG_NOACCESS,
} pkg_error_t;

/**
modified libpkg/update.c
@@ -126,6 +126,13 @@ pkg_update(const char *name, const char *packagesite, bool force)
		goto cleanup;
	}

+
	if (eaccess(repofile, W_OK) == -1) {
+
		pkg_emit_error("Insufficient privilege to update %s\n",
+
			       repofile);
+
		rc = EPKG_NOACCESS;
+
		goto cleanup;
+
	}
+

	a = archive_read_new();
	archive_read_support_compression_all(a);
	archive_read_support_format_tar(a);