Disk (BSD): dont set createTime if stat fails to detect it

This commit is contained in:
Carter Li
2024-05-18 13:38:07 +08:00
parent ed02845c40
commit 15766f5266
+1 -1
View File
@@ -140,7 +140,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
disk->type |= FF_DISK_VOLUME_TYPE_READONLY_BIT;
struct stat st;
if(stat(fs->f_mntonname, &st) == 0)
if(stat(fs->f_mntonname, &st) == 0 && st.st_birthtimespec.tv_sec > 0)
disk->createTime = (uint64_t)((st.st_birthtimespec.tv_sec * 1000) + (st.st_birthtimespec.tv_nsec / 1000000));
}