X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fftell.c;h=4ad13c9f486f1a5065a9365897a2c710806f1c8c;hb=beae0bdcf7fe30f2415c16f6b8c1368d469e519c;hp=84622d7133e8cb009fcec2306130c88378b00590;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/ftell.c b/lib/ftell.c index 84622d713..4ad13c9f4 100644 --- a/lib/ftell.c +++ b/lib/ftell.c @@ -1,5 +1,5 @@ /* An ftell() function that works around platform bugs. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,16 +20,15 @@ #include #include -/* Get off_t. */ -#include +#include long ftell (FILE *fp) { /* Use the replacement ftello function with all its workarounds. */ off_t offset = ftello (fp); - if (offset == (long)offset) - return (long)offset; + if (LONG_MIN <= offset && offset <= LONG_MAX) + return /* (long) */ offset; else { errno = EOVERFLOW;