Changeset 97553 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 15, 2022 4:29:49 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 154584
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r97541 r97553 1614 1614 if (strErrorInfo.isEmpty()) 1615 1615 strErrorInfo.printf(tr("Failed with %Rrc"), vrc); 1616 hrc =setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo);1616 setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo); 1617 1617 } 1618 1618 … … 1973 1973 1974 1974 RTFSOBJINFO srcFsObjInfo; 1975 vrc = RTPathQueryInfoEx(strSrc.c_str(), &srcFsObjInfo, RTFSOBJATTRADD_NOTHING, 1976 fFollowSymlinks ? RTPATH_F_FOLLOW_LINK : RTPATH_F_ON_LINK /* fFlags */); 1975 vrc = RTPathQueryInfoEx(strSrc.c_str(), &srcFsObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK /* fFlags */); 1977 1976 if (RT_FAILURE(vrc)) 1978 1977 { … … 1981 1980 } 1982 1981 1983 if (RTFS_IS_DIRECTORY(srcFsObjInfo.Attr.fMode)) 1984 { 1985 if (itSrc->enmType != FsObjType_Directory) 1986 { 1987 strErrorInfo.printf(tr("Host source is not a file: %s"), strSrc.c_str()); 1988 vrc = VERR_NOT_A_FILE; 1982 switch (srcFsObjInfo.Attr.fMode & RTFS_TYPE_MASK) 1983 { 1984 case RTFS_TYPE_DIRECTORY: 1985 { 1986 if (itSrc->enmType != FsObjType_Directory) 1987 { 1988 strErrorInfo.printf(tr("Host source \"%s\" is not a file (is a directory)"), strSrc.c_str()); 1989 vrc = VERR_NOT_A_FILE; 1990 } 1989 1991 break; 1990 1992 } 1991 } 1992 else 1993 { 1994 if (itSrc->enmType == FsObjType_Directory) 1995 { 1996 strErrorInfo.printf(tr("Host source is not a directory: %s"), strSrc.c_str()); 1997 vrc = VERR_NOT_A_DIRECTORY; 1993 1994 case RTFS_TYPE_FILE: 1995 { 1996 if (itSrc->enmType == FsObjType_Directory) 1997 { 1998 strErrorInfo.printf(tr("Host source \"%s\" is not a directory (is a file)"), strSrc.c_str()); 1999 vrc = VERR_NOT_A_DIRECTORY; 2000 } 1998 2001 break; 1999 2002 } 2000 } 2003 2004 case RTFS_TYPE_SYMLINK: 2005 { 2006 if (!fFollowSymlinks) 2007 { 2008 strErrorInfo.printf(tr("Host source \"%s\" is a symbolic link"), strSrc.c_str()); 2009 vrc = VERR_IS_A_SYMLINK; 2010 break; 2011 } 2012 2013 char szPathReal[RTPATH_MAX]; 2014 vrc = RTPathReal(strSrc.c_str(), szPathReal, sizeof(szPathReal)); 2015 if (RT_SUCCESS(vrc)) 2016 { 2017 vrc = RTPathQueryInfoEx(szPathReal, &srcFsObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_FOLLOW_LINK); 2018 if (RT_SUCCESS(vrc)) 2019 { 2020 LogRel2(("Guest Control: Host source symbolic link '%s' -> '%s' (%s)\n", 2021 strSrc.c_str(), szPathReal, 2022 GuestBase::fsObjTypeToStr(GuestBase::fileModeToFsObjType(srcFsObjInfo.Attr.fMode)))); 2023 2024 /* We want to keep the symbolic link name of the source instead of the target pointing to, 2025 * so don't touch the source's name here. */ 2026 itSrc->enmType = GuestBase::fileModeToFsObjType(srcFsObjInfo.Attr.fMode); 2027 } 2028 else 2029 { 2030 strErrorInfo.printf(tr("Querying symbolic link info for host source \"%s\" failed"), strSrc.c_str()); 2031 break; 2032 } 2033 } 2034 else 2035 { 2036 strErrorInfo.printf(tr("Resolving symbolic link for host source \"%s\" failed"), strSrc.c_str()); 2037 break; 2038 } 2039 break; 2040 } 2041 2042 default: 2043 LogRel2(("Guest Control: Warning: Unknown host file system type %#x for source \"%s\", skipping\n", 2044 srcFsObjInfo.Attr.fMode & RTFS_TYPE_MASK, strSrc.c_str())); 2045 break; 2046 } 2047 2048 if (RT_FAILURE(vrc)) 2049 break; 2001 2050 2002 2051 FsList *pFsList = NULL; … … 2022 2071 break; 2023 2072 2073 case FsObjType_Symlink: 2074 AssertFailed(); /* Should never get here, as we do the resolving above. */ 2075 break; 2076 2024 2077 default: 2025 LogRel2(("Guest Control: Warning: Unknown guest host system type %#x forsource \"%s\", skipping\n",2078 LogRel2(("Guest Control: Warning: Unknown source type %#x for host source \"%s\", skipping\n", 2026 2079 itSrc->enmType, strSrc.c_str())); 2027 2080 break; … … 2086 2139 if (strErrorInfo.isEmpty()) 2087 2140 strErrorInfo.printf(tr("Failed with %Rrc"), vrc); 2088 hrc =setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo);2141 setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo); 2089 2142 } 2090 2143
Note:
See TracChangeset
for help on using the changeset viewer.