diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h')
-rw-r--r-- | sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h index 9d70532150..f63dbfae89 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h +++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h @@ -1,5 +1,5 @@ /* Overflow tests for stat, statfs, and lseek functions. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library. If not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <sys/stat.h> #include <sys/statfs.h> @@ -36,25 +36,33 @@ static inline off_t lseek_overflow (loff_t res) static inline int stat_overflow (struct stat *buf) { - if (buf->__st_ino_pad == 0 && buf->__st_size_pad == 0 && - buf->__st_blocks_pad == 0) +#if defined __INO_T_MATCHES_INO64_T + return 0; +#else + if (buf->__st_ino_pad == 0 && buf->__st_size_pad == 0 + && buf->__st_blocks_pad == 0) return 0; __set_errno (EOVERFLOW); return -1; +#endif } /* Note that f_files and f_ffree may validly be a sign-extended -1. */ static inline int statfs_overflow (struct statfs *buf) { - if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0 && - buf->__f_bavail_pad == 0 && - (buf->__f_files_pad == 0 || - (buf->f_files == -1U && buf->__f_files_pad == -1)) && - (buf->__f_ffree_pad == 0 || - (buf->f_ffree == -1U && buf->__f_ffree_pad == -1))) +#if __STATFS_MATCHES_STATFS64 + return 0; +#else + if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0 + && buf->__f_bavail_pad == 0 + && (buf->__f_files_pad == 0 + || (buf->f_files == -1U && buf->__f_files_pad == -1)) + && (buf->__f_ffree_pad == 0 + || (buf->f_ffree == -1U && buf->__f_ffree_pad == -1))) return 0; __set_errno (EOVERFLOW); return -1; +#endif } |