summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorJakob Pfender <jpfender@elegosoft.com>2011-05-25 16:11:57 +0200
committerJakob Pfender <jpfender@elegosoft.com>2011-06-07 12:54:37 +0200
commit1869b31e0c99831b1de394ef8cb4d0c9ee633bea (patch)
tree1eed3d9adbe87acbab1dd3565ab6afd905259300 /src/index.c
parent4d7905c579a4a89a4894ec1cea1f593338d1042f (diff)
downloadlibgit2-1869b31e0c99831b1de394ef8cb4d0c9ee633bea.tar.gz
index/fileops: Correctly process symbolic links
gitfo_exists() used to error out if the given file was a symbolic link, due to access() returning an error code. This is not expected behaviour, as gitfo_exists() should only check whether the file itself exists, not its link target if it is a symbolic link. Fix this by calling gitfo_lstat() instead, which is just a wrapper for lstat(). Also fix the same error in index_init_entry().
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c
index 6aefe4432..e1b52610b 100644
--- a/src/index.c
+++ b/src/index.c
@@ -405,7 +405,7 @@ static int index_init_entry(git_index_entry *entry, git_index *index, const char
if (gitfo_exists(full_path) < 0)
return git__throw(GIT_ENOTFOUND, "Failed to initialize entry. %s does not exist", full_path);
- if (gitfo_stat(full_path, &st) < 0)
+ if (gitfo_lstat(full_path, &st) < 0)
return git__throw(GIT_EOSERR, "Failed to initialize entry. %s appears to be corrupted", full_path);
if (stage < 0 || stage > 3)