Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Avoid useless strrchr.
Vsevolod Stakhov committed 13 years ago
commit 9d886a6b3c9a755062d8cf762bc75a621bdad8c3
parent d9a542d
1 file changed +3 -3
modified libpkg/utils.c
@@ -372,16 +372,16 @@ int
is_conf_file(const char *path, char *newpath, size_t len)
{
	size_t n;
-
	char *p = NULL;
+
	const char *p = NULL;

	n = strlen(path);

	if (n < 8)
		return (0);

-
	p = strrchr(path, '.');
+
	p = &path[len - 8];

-
	if (p != NULL && !strcmp(p, ".pkgconf")) {
+
	if (strcmp(p, ".pkgconf") == 0) {
		strlcpy(newpath, path, len);
		newpath[n - 8] = '\0';
		return (1);