From 0766fb8b54c46d0f17d99d154c0420b73b8cea4b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 26 Oct 2006 15:16:41 +0200 Subject: [PATCH] * src/system.h (ftello): Add a compile-time check for the highly unlikely condition of off_t narrower than long int, rather than handling it at run time. Based on a patch from Paul Eggert. --- ChangeLog | 6 ++++++ src/system.h | 11 ++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a09b53845b..18970d0df9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-10-26 Jim Meyering + + * src/system.h (ftello): Add a compile-time check for the highly + unlikely condition of off_t narrower than long int, rather than + handling it at run time. Based on a patch from Paul Eggert. + 2006-10-25 Paul Eggert * tests/chmod/c-option: When double-quoting part of a word, prefer diff --git a/src/system.h b/src/system.h index efe9290984..edb3edecd9 100644 --- a/src/system.h +++ b/src/system.h @@ -524,15 +524,8 @@ enum # if ! defined ftello static inline off_t ftello (FILE *stream) { - off_t off = ftell (stream); - if (off < 0) - return off; - if (off != (long int) off) - { - errno = EOVERFLOW; - return -1; - } - return off; + verify (sizeof (long int) <= sizeof (off_t)); + return ftell (stream); } # endif #endif -- 2.47.3