VirtualBox

Changeset 97685 in vbox


Ignore:
Timestamp:
Nov 25, 2022 5:58:01 PM (2 years ago)
Author:
vboxsync
Message:

IPRT/fs-posix.cpp: Update RTFsQueryType() to use statvfs(2) instead of
stat(2) on Solaris. All RTFsQueryType() calls reference paths under
$HOME but Solaris 11 defaults to loopback mounting home directories
which means stat(2) always returns "lofs" so use statvfs(2) to get
the underlying file system type instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/fs-posix.cpp

    r96407 r97685  
    295295
    296296#elif defined(RT_OS_SOLARIS)
    297             if (!strcmp("zfs", Stat.st_fstype))
    298                 *penmType = RTFSTYPE_ZFS;
    299             else if (!strcmp("ufs", Stat.st_fstype))
    300                 *penmType = RTFSTYPE_UFS;
    301             else if (!strcmp("nfs", Stat.st_fstype))
    302                 *penmType = RTFSTYPE_NFS;
     297            /*
     298             * Home directories are normally loopback mounted in Solaris 11 (st_fstype=="lofs")
     299             * so statvfs(2) is needed to get the underlying file system information.
     300             */
     301            struct statvfs statvfsBuf;
     302            if (!statvfs(pszNativeFsPath, &statvfsBuf))
     303            {
     304                if (!strcmp("zfs", statvfsBuf.f_basetype))
     305                    *penmType = RTFSTYPE_ZFS;
     306                else if (!strcmp("ufs", statvfsBuf.f_basetype))
     307                    *penmType = RTFSTYPE_UFS;
     308                else if (!strcmp("nfs", statvfsBuf.f_basetype))
     309                    *penmType = RTFSTYPE_NFS;
     310            }
    303311
    304312#elif defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
Note: See TracChangeset for help on using the changeset viewer.

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