X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fftell.c;h=817e9ff068b1814d431e17992c93a53a9252b36f;hb=387c96fc38b1985d677a25881ab99a449a00af22;hp=84622d7133e8cb009fcec2306130c88378b00590;hpb=57fdfd3f8ec62b105c53bcdf6f127c35c7fe7391;p=gnulib.git diff --git a/lib/ftell.c b/lib/ftell.c index 84622d713..817e9ff06 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-2012 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;