[pacman-dev] [PATCH] query_fileowner: resolve trailing . or .. in paths

Andrew Gregory andrew.gregory.8 at gmail.com
Wed Jun 19 01:23:20 EDT 2013


The full path needs to resolved any time it ends with "." or "..", not
just when those are the entire path.  This allows strange-but-valid
paths such as: "/home/." to be queried.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/query.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pacman/query.c b/src/pacman/query.c
index 1b6e14c..819a571 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -102,7 +102,7 @@ static char *lrealpath(const char *path, char *resolved_path)
 	char *rpath = NULL, *dname = NULL;
 	int success = 0;
 
-	if(strcmp(path, ".") == 0 || strcmp(path, "..") == 0) {
+	if(strcmp(bname, ".") == 0 || strcmp(bname, "..") == 0) {
 		/* the entire path needs to be resolved */
 		return realpath(path, resolved_path);
 	}
-- 
1.8.3.1



More information about the pacman-dev mailing list