AmendHub

Download:

jcs

/

subtext

/

amendments

/

581

util: Don't include resource fork length in FStat st_size

This is usually used to figure out how big a file is to allocate a
buffer of that size and then FSRead it, but if we're including the
resource fork length, we'll do what appears to be a short read.

jcs made amendment 581 3 months ago
--- util.c Mon Apr 10 21:44:25 2023 +++ util.c Wed Jan 24 09:19:14 2024 @@ -912,9 +912,8 @@ FStat(Str255 path, struct stat *sb) if (ret != noErr) return -1; - /* data fork logical length + resource fork logical length */ - sb->st_size = catblock.hFileInfo.ioFlLgLen + - catblock.hFileInfo.ioFlRLgLen; + /* data fork logical length, ignoring resource fork logical length */ + sb->st_size = catblock.hFileInfo.ioFlLgLen; sb->st_ctime = catblock.hFileInfo.ioFlCrDat; sb->st_mtime = catblock.hFileInfo.ioFlMdDat; sb->st_flags = catblock.hFileInfo.ioFlAttrib;