Skip to content

Commit

Permalink
Adapt to microsoft#297. This makes the situation much easier
Browse files Browse the repository at this point in the history
  • Loading branch information
schinagl committed Feb 24, 2022
1 parent f22b500 commit 3329aeb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/wfcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,8 +1443,7 @@ GetNextPair(PCOPYROOT pcr, LPTSTR pFrom,
goto FastMoveSkipDir;
#endif
// Check if we should skip an entry because it was e.g. an reparse point
if (pDTA->fd.dwFileAttributes & ATTR_SYMBOLIC) {
pDTA->fd.dwFileAttributes &= ~ATTR_SYMBOLIC;
if (pDTA->fd.dwFileAttributes & ( ATTR_SYMBOLIC | ATTR_JUNCTION) ) {
RemoveLast(pcr->szDest);
goto SkipThisFile;
}
Expand Down Expand Up @@ -1693,7 +1692,7 @@ GetNextPair(PCOPYROOT pcr, LPTSTR pFrom,
}

// Skip reparse points
if (dwFunc == FUNC_DELETE && pDTA->fd.dwFileAttributes & ATTR_REPARSE_POINT) {
if (dwFunc == FUNC_DELETE && pDTA->fd.dwFileAttributes & (ATTR_SYMBOLIC | ATTR_JUNCTION)) {
pcr->fRecurse = FALSE;
dwOp = OPER_RMDIR;
goto ReturnPair;
Expand Down Expand Up @@ -2738,13 +2737,10 @@ WFMoveCopyDriverThread(LPVOID lpParameter)
}
#endif

// Check if we came a long a reparse point
dwAttr = GetFileAttributes(szSource);
if (dwAttr & ATTR_REPARSE_POINT) {
// Yes, lets unlink it, but signal GetNextPair() that it should not crawl down the reparse point.
// We are using ATTR_SYMBOLIC to flag Junctions and Symbolic Links here
// Check if we came a long a junction or symbolic link
if (pDTA->fd.dwFileAttributes & (ATTR_SYMBOLIC | ATTR_JUNCTION)) {
// Just unlink it
ret = RMDir(szSource);
pDTA->fd.dwFileAttributes |= ATTR_SYMBOLIC;
}
break;

Expand Down

0 comments on commit 3329aeb

Please sign in to comment.