Opened 7 years ago

Closed 7 years ago

#5535 closed defect (fixed)

VSIReadDirRecursive recurses forever

Reported by: Kurt Schwehr Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords: port, vsi
Cc:

Description (last modified by Kurt Schwehr)

I'm seeing VSIReadDirRecursive recurse forever in a small test program pointing to a directory. It appears to be walking "." and ".." and thus heading for trouble.

source:trunk/gdal/port/cpl_vsil.cpp#L131

Proposed fix:

  • cpl_vsil.cpp

     
    130130
    131131        for ( ; i < nCount; i++ )
    132132        {
     133            // Do not recurse up the tree.
     134            // TODO(schwehr): Is this portable to all filesystems?
     135            if (EQUAL(".", papszFiles[i]) || EQUAL("..", papszFiles[i]))
     136              continue;
     137
    133138            // build complete file name for stat
    134139            osTemp1.clear();
    135140            osTemp1.append( pszPath );

Change History (2)

comment:1 Changed 7 years ago by Kurt Schwehr

Description: modified (diff)

comment:2 Changed 7 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Committed in trunk r27468

Note: See TracTickets for help on using tickets.