diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-07-23 18:34:10 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-07-23 18:34:10 +0000 |
commit | 52972f605dfe64fb18bcd752fab8476e596853d7 (patch) | |
tree | 4ec44c6aa24f4faccbeff3a1504261df8dd8fa15 /wiretap/file_wrappers.c | |
parent | c9e6eda76992311af7b33b8a6e1f21024c1cf251 (diff) |
Handle operating systems that are anticipating the day when files should
be read in chunks > 2GB.
svn path=/trunk/; revision=50847
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r-- | wiretap/file_wrappers.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c index 973b2a19f7..2eff49eb50 100644 --- a/wiretap/file_wrappers.c +++ b/wiretap/file_wrappers.c @@ -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 |