Skip to content

Commit

Permalink
Merge branch 'main' into fixes-target-shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Miauwkeru authored Nov 12, 2024
2 parents 89ce9c3 + 0f32b4e commit 58a51a2
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions dissect/target/filesystems/fat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import math
import stat
from typing import BinaryIO, Iterator, Optional, Union

Expand Down Expand Up @@ -100,16 +101,21 @@ def stat(self, follow_symlinks: bool = True) -> fsutil.stat_result:
def lstat(self) -> fsutil.stat_result:
"""Return the stat information of the given path, without resolving links."""
# mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime
st_info = [
(stat.S_IFDIR if self.is_dir() else stat.S_IFREG) | 0o777,
self.entry.cluster,
id(self.fs),
1,
0,
0,
self.entry.size,
self.entry.atime.replace(tzinfo=self.fs.tzinfo).timestamp(),
self.entry.mtime.replace(tzinfo=self.fs.tzinfo).timestamp(),
self.entry.ctime.replace(tzinfo=self.fs.tzinfo).timestamp(),
]
return fsutil.stat_result(st_info)
st_info = fsutil.stat_result(
[
(stat.S_IFDIR if self.is_dir() else stat.S_IFREG) | 0o777,
self.entry.cluster,
id(self.fs),
1,
0,
0,
self.entry.size,
self.entry.atime.replace(tzinfo=self.fs.tzinfo).timestamp(),
self.entry.mtime.replace(tzinfo=self.fs.tzinfo).timestamp(),
self.entry.ctime.replace(tzinfo=self.fs.tzinfo).timestamp(),
]
)

st_info.st_blocks = math.ceil(self.entry.size / self.entry.fs.cluster_size)
st_info.st_blksize = self.entry.fs.cluster_size
return st_info

0 comments on commit 58a51a2

Please sign in to comment.