NTFS: Fix directory size calculation in rstat function (bug:#8599).
This commit is contained in:
parent
9aaf8ee203
commit
a65ebe7546
|
@ -636,13 +636,19 @@ fs_rstat(fs_volume *_vol, fs_vnode *_node, struct stat *stbuf)
|
|||
if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
|
||||
// Directory
|
||||
stbuf->st_mode = FS_DIR_MODE;
|
||||
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
if (na) {
|
||||
stbuf->st_size = na->data_size;
|
||||
stbuf->st_blocks = na->allocated_size >> 9;
|
||||
ntfs_attr_close(na);
|
||||
/* get index size, if not known */
|
||||
if (!test_nino_flag(ni, KnownSize)) {
|
||||
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
|
||||
if (na) {
|
||||
ni->data_size = na->data_size;
|
||||
ni->allocated_size = na->allocated_size;
|
||||
set_nino_flag(ni, KnownSize);
|
||||
ntfs_attr_close(na);
|
||||
}
|
||||
}
|
||||
stbuf->st_nlink = 1;
|
||||
stbuf->st_size = ni->data_size;
|
||||
stbuf->st_blocks = ni->allocated_size >> 9;
|
||||
stbuf->st_nlink = 1; /* Make find(1) work */
|
||||
} else {
|
||||
// Regular or Interix (INTX) file
|
||||
stbuf->st_mode = FS_FILE_MODE;
|
||||
|
|
Loading…
Reference in New Issue