Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkgdb: change the syscall overload to allow subdirectories
Baptiste Daroussin committed 2 years ago
commit c3d3b87db9fe1a914cdc6680c13c1c76c839fca0
parent 0cd7b95
1 file changed +13 -1
modified libpkg/pkgdb.c
@@ -848,7 +848,19 @@ pkgdb_open_repos(struct pkgdb *db, const char *reponame)
static const char*
_dbdir_trim_path(const char*path)
{
-
	const char *p = strrchr(path, '/');
+
	static size_t l = 0;
+
	const char *p;
+

+
	if (l == 0)
+
		l = strlen(ctx.dbdir);
+

+
	if (strncmp(ctx.dbdir, path, l) == 0) {
+
		p = path + l;
+
		while (*p == '/')
+
			p++;
+
		return (p);
+
	}
+
	p = strrchr(path, '/');

	if(p == NULL)
		return (path);