Skip to content

Commit 82cdc4c

Browse files
committed
Disk (Linux): avoids invalid disk creation times before Linux epoch
Prevent fastfetch from printing invalid create date on Android
1 parent 822ddc6 commit 82cdc4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/detection/disk/disk_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static void detectStats(FFDisk* disk)
269269
disk->createTime = 0;
270270
#ifdef SYS_statx
271271
struct statx stx;
272-
if (syscall(SYS_statx, 0, disk->mountpoint.chars, 0, STATX_BTIME, &stx) == 0 && (stx.stx_mask & STATX_BTIME))
272+
if (syscall(SYS_statx, 0, disk->mountpoint.chars, 0, STATX_BTIME, &stx) == 0 && (stx.stx_mask & STATX_BTIME) && stx.stx_btime.tv_sec > 685065600 /*birth of Linux*/)
273273
disk->createTime = (uint64_t)((stx.stx_btime.tv_sec * 1000) + (stx.stx_btime.tv_nsec / 1000000));
274274
#endif
275275

0 commit comments

Comments
 (0)