mirror of
https://github.com/git-for-windows/git.git
synced 2026-05-31 02:17:14 -05:00
Win32: fix 'lstat("dir/")' with long paths
Use a suffciently large buffer to strip the trailing slash. Signed-off-by: Karsten Blees <blees@dcon.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
94378c11ae
commit
a5d11abc13
@@ -1009,7 +1009,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
|
|||||||
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
|
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
|
||||||
{
|
{
|
||||||
size_t namelen;
|
size_t namelen;
|
||||||
char alt_name[PATH_MAX];
|
char alt_name[MAX_LONG_PATH];
|
||||||
|
|
||||||
if (!do_lstat(follow, file_name, buf))
|
if (!do_lstat(follow, file_name, buf))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1025,7 +1025,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
|
|||||||
return -1;
|
return -1;
|
||||||
while (namelen && file_name[namelen-1] == '/')
|
while (namelen && file_name[namelen-1] == '/')
|
||||||
--namelen;
|
--namelen;
|
||||||
if (!namelen || namelen >= PATH_MAX)
|
if (!namelen || namelen >= MAX_LONG_PATH)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(alt_name, file_name, namelen);
|
memcpy(alt_name, file_name, namelen);
|
||||||
|
|||||||
Reference in New Issue
Block a user