@@ -492,7 +492,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void)
492
492
static size_t tsrm_realpath_r (char * path , size_t start , size_t len , int * ll , time_t * t , int use_realpath , int is_dir , int * link_is_dir ) /* {{{ */
493
493
{
494
494
size_t i , j ;
495
- int directory = 0 , save ;
495
+ int directory = 0 , save , may_retry_reparse_point ;
496
496
#ifdef ZEND_WIN32
497
497
WIN32_FIND_DATAW dataw ;
498
498
HANDLE hFind = INVALID_HANDLE_VALUE ;
@@ -597,6 +597,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
597
597
598
598
#ifdef ZEND_WIN32
599
599
retry_reparse_point :
600
+ may_retry_reparse_point = 0 ;
600
601
if (save ) {
601
602
pathw = php_win32_ioutil_any_to_w (path );
602
603
if (!pathw ) {
@@ -691,6 +692,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
691
692
CloseHandle (hLink );
692
693
693
694
if (pbuffer -> ReparseTag == IO_REPARSE_TAG_SYMLINK ) {
695
+ may_retry_reparse_point = 1 ;
694
696
reparsetarget = pbuffer -> SymbolicLinkReparseBuffer .ReparseTarget ;
695
697
isabsolute = pbuffer -> SymbolicLinkReparseBuffer .Flags == 0 ;
696
698
#if VIRTUAL_CWD_DEBUG
@@ -827,7 +829,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
827
829
free_alloca (pbuffer , use_heap_large );
828
830
free (substitutename );
829
831
830
- {
832
+ if ( may_retry_reparse_point ) {
831
833
DWORD attrs ;
832
834
833
835
FREE_PATHW ()
0 commit comments