Commit c655fd934cee923423377833208cc041a67e4217

Stefan Sperling 2022-04-07T12:04:42

rename variables in got_path_strip() for clarity; ok op@

diff --git a/lib/path.c b/lib/path.c
index 9a0217a..d0ec896 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -125,16 +125,16 @@ got_path_strip(char **out, const char *path, int n)
 	p = path;
 	*out = NULL;
 
-	while (n > 0 && (c = strchr(path, '/')) != NULL) {
-		path = c + 1;
+	while (n > 0 && (c = strchr(p, '/')) != NULL) {
+		p = c + 1;
 		n--;
 	}
 
 	if (n > 0)
 		return got_error_fmt(GOT_ERR_BAD_PATH,
-		    "can't strip %d path-components from %s", n, p);
+		    "can't strip %d path-components from %s", n, path);
 
-	if ((*out = strdup(path)) == NULL)
+	if ((*out = strdup(p)) == NULL)
 		return got_error_from_errno("strdup");
 	return NULL;
 }