Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Barvik <barvik@broadpark.no>2009-06-14 17:08:28 +0400
committerJunio C Hamano <gitster@pobox.com>2009-07-30 07:20:12 +0400
commit77716755cbdf970fa0814a5f77c884b1f17693de (patch)
tree7ea6ab124233dafe0d1d9a894e298fc9a1e51f5c /symlinks.c
parent4f6339b0c353b5c03b566b605e50a743d97fc08e (diff)
lstat_cache: guard against full match of length of 'name' parameter
longest_path_match() in symlinks.c does exactly what it's name says, but in some cases that match can be too long, since the has_*_leading_path() functions assumes that the match will newer be as long as the name string given to the function. fix this by adding an extra if test which checks if the match length is equal to the 'len' parameter. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'symlinks.c')
-rw-r--r--symlinks.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/symlinks.c b/symlinks.c
index 4bdded39c5..7b0a86d357 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -91,6 +91,10 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
longest_path_match(name, len, cache->path, cache->len,
&previous_slash);
match_flags = cache->flags & track_flags & (FL_NOENT|FL_SYMLINK);
+
+ if (!(track_flags & FL_FULLPATH) && match_len == len)
+ match_len = last_slash = previous_slash;
+
if (match_flags && match_len == cache->len)
return match_flags;
/*