summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fileops.c4
-rw-r--r--src/fileops.h1
-rw-r--r--src/index.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/fileops.c b/src/fileops.c
index b1a6bb8b1..92b95c5dd 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -172,7 +172,9 @@ int gitfo_isfile(const char *path)
int gitfo_exists(const char *path)
{
assert(path);
- return access(path, F_OK);
+
+ struct stat st;
+ return gitfo_lstat(path, &st);
}
git_off_t gitfo_size(git_file fd)
diff --git a/src/fileops.h b/src/fileops.h
index c114508db..f27f2c9e3 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -94,6 +94,7 @@ extern int gitfo_mv_force(const char *from, const char *to);
#define gitfo_stat(p,b) stat(p, b)
#define gitfo_fstat(f,b) fstat(f, b)
+#define gitfo_lstat(p,b) lstat(p,b)
#define gitfo_unlink(p) unlink(p)
#define gitfo_rmdir(p) rmdir(p)
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)