st_blocks incorrect for files larger than 2Gbytes

DJ Delorie
Wed Jul 26 06:44:00 GMT 2000

>   buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE;
> which way is preferable?

Casting buf->st_size to (unsigned long) before doing the math is.
off_t is signed, but negative sizes are meaningless.

However, this topic belongs on the newlib list, not the cygwin list.

More information about the Cygwin-developers mailing list