summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Pokatilo <github@shyxormz.net>2013-02-08 00:50:20 +0100
committerPatrick Pokatilo <github@shyxormz.net>2013-02-08 00:50:20 +0100
commit3b5e44aeba0fbbbc324939a71727757d97a8ee7b (patch)
tree3437c619d019647f6be374ce0d341a97a5293c0d /src
parent94ed23f86a0708a95c5d2c58b38ba0cd8acd0c97 (diff)
downloadlibgit2-3b5e44aeba0fbbbc324939a71727757d97a8ee7b.tar.gz
Fix call to readlink
Diffstat (limited to 'src')
-rw-r--r--src/win32/posix_w32.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index b561e329a..ece722305 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -100,6 +100,9 @@ static int do_lstat(
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
+ /* Windows symlinks have zero file size, call readlink to determine
+ * the length of the path pointed to, which we expect everywhere else
+ */
if (fMode & S_IFLNK)
{
char target[GIT_WIN_PATH];
@@ -107,7 +110,7 @@ static int do_lstat(
readlink_result = p_readlink(file_name, target, GIT_WIN_PATH);
- if (readlink_result)
+ if (readlink_result == -1)
return -1;
buf->st_size = strnlen(target, GIT_WIN_PATH);