summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Pokatilo <github@shyxormz.net>2013-02-07 01:41:20 +0100
committerPatrick Pokatilo <github@shyxormz.net>2013-02-07 01:41:20 +0100
commit94ed23f86a0708a95c5d2c58b38ba0cd8acd0c97 (patch)
tree8e02ef74550fa9ccb4d5e9d8caa8af8457d739fd
parentfb60d268df2272626f48cfed7b2a185413e7e9f4 (diff)
downloadlibgit2-94ed23f86a0708a95c5d2c58b38ba0cd8acd0c97.tar.gz
Call p_readlink to determine symlink size
-rw-r--r--src/win32/posix_w32.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 0c23e2959..b561e329a 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -99,6 +99,19 @@ static int do_lstat(
buf->st_atime = filetime_to_time_t(&(fdata.ftLastAccessTime));
buf->st_mtime = filetime_to_time_t(&(fdata.ftLastWriteTime));
buf->st_ctime = filetime_to_time_t(&(fdata.ftCreationTime));
+
+ if (fMode & S_IFLNK)
+ {
+ char target[GIT_WIN_PATH];
+ int readlink_result;
+
+ readlink_result = p_readlink(file_name, target, GIT_WIN_PATH);
+
+ if (readlink_result)
+ return -1;
+
+ buf->st_size = strnlen(target, GIT_WIN_PATH);
+ }
return 0;
}