X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fftell.c;h=d5cbccd756aed3be8655ffddaaded801bc01f3c6;hb=1276a2c5f24c0c932426aca9c899fa524d2443f2;hp=1abf4949dc93d256d46461b9c45fa31c0fd2a913;hpb=dac3bbf96357f7866a1094c228b4e5bea3fcf853;p=gnulib.git diff --git a/lib/ftell.c b/lib/ftell.c index 1abf4949d..d5cbccd75 100644 --- a/lib/ftell.c +++ b/lib/ftell.c @@ -1,5 +1,5 @@ /* An ftell() function that works around platform bugs. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007-2014 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;