]> git.proxmox.com Git - libgit2.git/commitdiff
Call p_readlink to determine symlink size
authorPatrick Pokatilo <github@shyxormz.net>
Thu, 7 Feb 2013 00:41:20 +0000 (01:41 +0100)
committerPatrick Pokatilo <github@shyxormz.net>
Thu, 7 Feb 2013 00:41:20 +0000 (01:41 +0100)
src/win32/posix_w32.c

index 0c23e2959bd010c5d8c6ccedb0d571367190a1f9..b561e329a93a8e750ac165b9dca520206724bb12 100644 (file)
@@ -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;
        }