Handle operating systems that are anticipating the day when files should

be read in chunks > 2GB.

svn path=/trunk/; revision=50847
This commit is contained in:
Guy Harris 2013-07-23 18:34:10 +00:00
parent c9e6eda769
commit 52972f605d
1 changed files with 9 additions and 1 deletions

View File

@ -815,7 +815,15 @@ file_fdopen(int fd)
#ifdef _STATBUF_ST_BLKSIZE
if (fstat(fd, &st) >= 0) {
want = st.st_blksize;
/*
* Yes, st_blksize can be bigger than an int; apparently,
* it's a long on LP64 Linux, for example.
*
* If the value is too big to fit into an int, just
* use the default.
*/
if (st.st_blksize <= G_MAXINT)
want = (int)st.st_blksize;
/* XXX, verify result? */
}
#endif