Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed FAT mktime work-around to patch sleuthkit source instead #102

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions patches/sleuthkit-4.12.1-fatfs_utils.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/tsk/fs/fatfs_utils.c b/tsk/fs/fatfs_utils.c
index 9495ac923..440b0dff8 100755
--- a/tsk/fs/fatfs_utils.c
+++ b/tsk/fs/fatfs_utils.c
@@ -179,8 +179,11 @@ fatfs_dos_2_unix_time(uint16_t date, uint16_t time, uint8_t timetens)
* it out */
tm1.tm_isdst = -1;

- ret = mktime(&tm1);
-
+#if defined( _MSC_VER )
+ ret = _mkgmtime(&tm1);
+#else
+ ret = timegm(&tm1);
+#endif
if (ret < 0) {
if (tsk_verbose)
tsk_fprintf(stderr,
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ def patch_sleuthkit(self):
fd.write(data)

patch_files = [
"sleuthkit-{0:s}-configure.ac".format(self._SLEUTHKIT_GIT_TAG)]
"sleuthkit-{0:s}-configure.ac".format(self._SLEUTHKIT_GIT_TAG),
"sleuthkit-{0:s}-fatfs_utils.c".format(self._SLEUTHKIT_GIT_TAG)]

for patch_file in patch_files:
patch_file = os.path.join("patches", patch_file)
Expand Down
14 changes: 0 additions & 14 deletions tsk3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,20 +695,6 @@ VIRTUAL(Volume_Info, Object) {


void tsk_init() {

// libtsk uses mktime and localtime that rely on the TZ environment variable
// however that leads to inconsistent behavior with different TZ values.
// Hence that we force TZ to be UTC, when possible.
#if defined( _MSC_VER )
_putenv_s("TZ", "UTC");
_tzset();

// Some installations of MinGW do not support setenv
#elif !defined( __MINGW32__ )
setenv("TZ", "UTC", 1);
tzset();
#endif

//tsk_verbose++;
Img_Info_init((Object)&__Img_Info);
FS_Info_init((Object)&__FS_Info);
Expand Down
Loading