VirtualBox

Changeset 69623 in vbox


Ignore:
Timestamp:
Nov 8, 2017 6:10:47 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
118983
Message:

fatvfs.cpp: drop duplicate '.' and '..' entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/fs/fatvfs.cpp

    r69622 r69623  
    40214021
    40224022    /*
    4023      * Fake '.' and '..' entries.
     4023     * Fake '.' and '..' entries (required for root, we do it everywhere).
    40244024     */
    40254025    if (pThis->offDir < 2)
     
    40484048        pDirEntry->cbName = pThis->offDir;
    40494049        return rc;
     4050    }
     4051    if (   pThis->offDir == 2
     4052        && pShared->cEntries >= 2)
     4053    {
     4054        /* Skip '.' and '..' entries if present. */
     4055        uint32_t            uBufferLock = UINT32_MAX;
     4056        uint32_t            cEntries    = 0;
     4057        PCFATDIRENTRYUNION  paEntries   = NULL;
     4058        int rc = rtFsFatDirShrd_GetEntriesAt(pShared, 0, &paEntries, &cEntries, &uBufferLock);
     4059        if (RT_FAILURE(rc))
     4060            return rc;
     4061        if (   (paEntries[0].Entry.fAttrib & FAT_ATTR_DIRECTORY)
     4062            && memcmp(paEntries[0].Entry.achName, RT_STR_TUPLE(".          ")) == 0)
     4063        {
     4064            if (   (paEntries[1].Entry.fAttrib & FAT_ATTR_DIRECTORY)
     4065                && memcmp(paEntries[1].Entry.achName, RT_STR_TUPLE("..         ")) == 0)
     4066                pThis->offDir += sizeof(paEntries[0]) * 2;
     4067            else
     4068                pThis->offDir += sizeof(paEntries[0]);
     4069        }
     4070        rtFsFatDirShrd_ReleaseBufferAfterReading(pShared, uBufferLock);
    40504071    }
    40514072
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette