VirtualBox

Changeset 3019 in kBuild


Ignore:
Timestamp:
Jan 7, 2017 12:07:08 AM (8 years ago)
Author:
bird
Message:

ntstat.c: mount point fix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/nt/ntstat.c

    r3014 r3019  
    645645        birdCloseFile(hFile);
    646646
    647         /*
    648          * If we hit a mount point (NTFS volume mounted under an empty NTFS directory),
    649          * we should return information about what's mounted there rather than the
    650          * directory it is mounted at as this is what UNIX does.
    651          */
    652         hFile = birdOpenFileExW(hRoot, pwszPath,
    653                                 FILE_READ_ATTRIBUTES,
    654                                 FILE_ATTRIBUTE_NORMAL,
    655                                 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
    656                                 FILE_OPEN,
    657                                 FILE_OPEN_FOR_BACKUP_INTENT,
    658                                 OBJ_CASE_INSENSITIVE);
    659         if (hFile != INVALID_HANDLE_VALUE)
    660         {
    661             rc = birdStatHandle2(hFile, pStat, NULL, pwszPath);
    662             pStat->st_ismountpoint = 2;
    663             birdCloseFile(hFile);
     647        if (rc || !pStat->st_ismountpoint)
     648        { /* very likely */ }
     649        else
     650        {
     651            /*
     652             * If we hit a mount point (NTFS volume mounted under an empty NTFS directory),
     653             * we should return information about what's mounted there rather than the
     654             * directory it is mounted at as this is what UNIX does.
     655             */
     656            hFile = birdOpenFileExW(hRoot, pwszPath,
     657                                    FILE_READ_ATTRIBUTES,
     658                                    FILE_ATTRIBUTE_NORMAL,
     659                                    FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
     660                                    FILE_OPEN,
     661                                    FILE_OPEN_FOR_BACKUP_INTENT,
     662                                    OBJ_CASE_INSENSITIVE);
     663            if (hFile != INVALID_HANDLE_VALUE)
     664            {
     665                rc = birdStatHandle2(hFile, pStat, NULL, pwszPath);
     666                pStat->st_ismountpoint = 2;
     667                birdCloseFile(hFile);
     668            }
    664669        }
    665670    }
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