about summary refs log tree commit diff
path: root/libio/ioftell.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/ioftell.c')
-rw-r--r--libio/ioftell.c9
1 files changed, 8 insertions, 1 deletions
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)