Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22ef0c2

Browse files
committed
Merge pull request libgit2#1680 from csware/win32-junction
Correctly handle win32 junctions
2 parents eddc1f1 + 4753711 commit 22ef0c2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/fileops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ int git_futils_mkdir(
350350
int tmp_errno = errno;
351351

352352
/* ignore error if directory already exists */
353-
if (p_stat(make_path.ptr, &st) < 0 ||
354-
!(S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))) {
353+
if (p_stat(make_path.ptr, &st) < 0 || !S_ISDIR(st.st_mode)) {
355354
errno = tmp_errno;
356355
giterr_set(GITERR_OS, "Failed to make directory '%s'", make_path.ptr);
357356
goto done;

src/win32/posix_w32.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ static int do_lstat(
9090
if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
9191
fMode |= S_IFLNK;
9292

93+
if ((fMode & (S_IFDIR | S_IFLNK)) == (S_IFDIR | S_IFLNK)) // junction
94+
fMode ^= S_IFLNK;
95+
9396
buf->st_ino = 0;
9497
buf->st_gid = 0;
9598
buf->st_uid = 0;

0 commit comments

Comments
 (0)