diff options
Diffstat (limited to 'src/VBox/Additions/linux/sharedfolders')
-rw-r--r-- | src/VBox/Additions/linux/sharedfolders/dirops.c | 5 | ||||
-rw-r--r-- | src/VBox/Additions/linux/sharedfolders/utils.c | 28 | ||||
-rw-r--r-- | src/VBox/Additions/linux/sharedfolders/vfsmod.c | 3 |
3 files changed, 24 insertions, 12 deletions
diff --git a/src/VBox/Additions/linux/sharedfolders/dirops.c b/src/VBox/Additions/linux/sharedfolders/dirops.c index fb8c8d59..2ff10bb0 100644 --- a/src/VBox/Additions/linux/sharedfolders/dirops.c +++ b/src/VBox/Additions/linux/sharedfolders/dirops.c @@ -486,13 +486,14 @@ static int vbsf_dir_read(struct file *dir, void *opaque, filldir_t filldir) uintptr_t const offEntryInBuf = (uintptr_t)pEntry - (uintptr_t)pBuf; uint16_t cbSrcName; uint16_t cchSrcName; + char *pszSrcName = pEntry->name.String.ach; AssertLogRelMsgBreak(offEntryInBuf + RT_UOFFSETOF(SHFLDIRINFO, name.String) <= cbValid, ("%#llx + %#x vs %#x\n", offEntryInBuf, RT_UOFFSETOF(SHFLDIRINFO, name.String), cbValid)); cbSrcName = pEntry->name.u16Size; cchSrcName = pEntry->name.u16Length; AssertLogRelBreak(offEntryInBuf + RT_UOFFSETOF(SHFLDIRINFO, name.String) + cbSrcName <= cbValid); AssertLogRelBreak(cchSrcName < cbSrcName); - AssertLogRelBreak(pEntry->name.String.ach[cchSrcName] == '\0'); + AssertLogRelBreak(pszSrcName[cchSrcName] == '\0'); /* * Filter out '.' and '..' entires. @@ -500,7 +501,7 @@ static int vbsf_dir_read(struct file *dir, void *opaque, filldir_t filldir) if ( cchSrcName > 2 || pEntry->name.String.ach[0] != '.' || ( cchSrcName == 2 - && pEntry->name.String.ach[1] != '.')) { + && pszSrcName[1] != '.')) { int const d_type = vbsf_get_d_type(pEntry->Info.Attr.fMode); ino_t const d_ino = (ino_t)offPos + 0xbeef; /* very fake */ bool fContinue; diff --git a/src/VBox/Additions/linux/sharedfolders/utils.c b/src/VBox/Additions/linux/sharedfolders/utils.c index 7c1fba95..0c57c08a 100644 --- a/src/VBox/Additions/linux/sharedfolders/utils.c +++ b/src/VBox/Additions/linux/sharedfolders/utils.c @@ -298,10 +298,21 @@ DECLINLINE(int) sf_file_mode_to_linux(uint32_t fVBoxMode, int fFixedMode, int fC */ static void vbsf_update_inode_timestamps(struct inode *pInode, PSHFLFSOBJINFO pObjInfo) { -#if RTLNX_VER_MIN(6,6,0) - struct timespec64 ts; - vbsf_time_to_linux(&ts, &pObjInfo->ChangeTime); - inode_set_ctime_to_ts(pInode, ts); +#if RTLNX_VER_MIN(6,7,0) + struct timespec64 tsAccessTime, tsChangeTime, ModificationTime; + + vbsf_time_to_linux(&tsAccessTime, &pObjInfo->AccessTime); + vbsf_time_to_linux(&tsChangeTime, &pObjInfo->ChangeTime); + vbsf_time_to_linux(&ModificationTime, &pObjInfo->ModificationTime); + + inode_set_atime_to_ts(pInode, tsAccessTime); + inode_set_ctime_to_ts(pInode, tsChangeTime); + inode_set_mtime_to_ts(pInode, ModificationTime); + +# elif RTLNX_VER_MIN(6,6,0) + vbsf_time_to_linux(&pInode->i_atime, &pObjInfo->AccessTime); + vbsf_time_to_linux(&pInode->__i_ctime, &pObjInfo->ChangeTime); + vbsf_time_to_linux(&pInode->i_mtime, &pObjInfo->ModificationTime); #else vbsf_time_to_linux(&pInode->i_atime, &pObjInfo->AccessTime); vbsf_time_to_linux(&pInode->i_ctime, &pObjInfo->ChangeTime); @@ -1047,10 +1058,11 @@ static int vbsf_make_path(const char *caller, struct vbsf_inode_info *sf_i, if (fRoot) RT_BCOPY_UNFORTIFIED(&tmp->String.utf8[0], d_name, d_len + 1); else { - RT_BCOPY_UNFORTIFIED(&tmp->String.utf8[0], p_name, p_len); - tmp->String.utf8[p_len] = '/'; - RT_BCOPY_UNFORTIFIED(&tmp->String.utf8[p_len + 1], d_name, d_len); - tmp->String.utf8[p_len + 1 + d_len] = '\0'; + uint8_t *pszPath = tmp->String.utf8; + RT_BCOPY_UNFORTIFIED(&pszPath[0], p_name, p_len); + pszPath[p_len] = '/'; + RT_BCOPY_UNFORTIFIED(&pszPath[p_len + 1], d_name, d_len); + pszPath[p_len + 1 + d_len] = '\0'; } *result = tmp; diff --git a/src/VBox/Additions/linux/sharedfolders/vfsmod.c b/src/VBox/Additions/linux/sharedfolders/vfsmod.c index 0c5c77af..5c4d55c1 100644 --- a/src/VBox/Additions/linux/sharedfolders/vfsmod.c +++ b/src/VBox/Additions/linux/sharedfolders/vfsmod.c @@ -474,8 +474,7 @@ static int vbsf_create_root_inode(struct super_block *sb, struct vbsf_super_info path->u16Length = 1; path->u16Size = 2; - path->String.utf8[0] = '/'; - path->String.utf8[1] = 0; + RTStrCopy(path->String.utf8, path->u16Size, "/"); /* * Stat the root directory (for inode info). |