diff options
Diffstat (limited to 'libio')
-rw-r--r-- | libio/ftello.c | 9 | ||||
-rw-r--r-- | libio/iofgetpos.c | 9 | ||||
-rw-r--r-- | libio/ioftell.c | 9 |
3 files changed, 24 insertions, 3 deletions
diff --git a/libio/ftello.c b/libio/ftello.c index dcecf5ee50..94a2541b25 100644 --- a/libio/ftello.c +++ b/libio/ftello.c @@ -35,7 +35,7 @@ off_t ftello (fp) _IO_FILE *fp; { - _IO_off_t pos; + _IO_off64_t pos; CHECK_FILE (fp, -1L); _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp); _IO_flockfile (fp); @@ -55,5 +55,12 @@ ftello (fp) #endif return -1L; } + if ((_IO_off64_t) (off_t) pos != pos) + { +#ifdef EOVERFLOW + __set_errno (EOVERFLOW); +#endif + return -1L; + } return pos; } diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c index c8eea79e9b..4b50898a07 100644 --- a/libio/iofgetpos.c +++ b/libio/iofgetpos.c @@ -35,7 +35,7 @@ _IO_new_fgetpos (fp, posp) _IO_FILE *fp; _IO_fpos_t *posp; { - _IO_off_t pos; + _IO_off64_t pos; int result = 0; CHECK_FILE (fp, EOF); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); @@ -56,6 +56,13 @@ _IO_new_fgetpos (fp, posp) #endif result = EOF; } + else if ((_IO_off64_t) (__typeof (posp->__pos)) pos != pos) + { +#ifdef EOVERFLOW + __set_errno (EOVERFLOW); +#endif + result = EOF; + } else { posp->__pos = pos; diff --git a/libio/ioftell.c b/libio/ioftell.c index 8328c5b042..2a389c37be 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -34,7 +34,7 @@ long int _IO_ftell (fp) _IO_FILE *fp; { - _IO_off_t pos; + _IO_off64_t pos; CHECK_FILE (fp, -1L); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); @@ -54,6 +54,13 @@ _IO_ftell (fp) #endif return -1L; } + if ((_IO_off64_t) (off_t) pos != pos) + { +#ifdef EOVERFLOW + __set_errno (EOVERFLOW); +#endif + return -1L; + } return pos; } INTDEF(_IO_ftell) |