Commit Diff


commit - d9db2ff90a20aac31e00f040738fd49a56b38d6b
commit + 7472ca4ef5ea6faebee012ddfbffd20fa9efddfb
blob - 0aaa95186aaed46ad2d54256cec06525008bd20f
blob + d033dc1152fcf6bcd0eea0dbb3ccc7d407c0a78f
--- lib/path.c
+++ lib/path.c
@@ -126,16 +126,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;
 }