Commit Diff


commit - 9d6cabd51222f7506db617ee8a7b282823dde999
commit + c655fd934cee923423377833208cc041a67e4217
blob - 9a0217a5e7d82ee2539af6b0e563a2c537f26621
blob + d0ec896bd7350a9da6048dc4c9ee1020412b2d56
--- lib/path.c
+++ 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;
 }