X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fftell.c;h=74ec986e27b1cede87d41db35db54591b3c0135b;hb=07809063056aef043ba738ab8229042f1ffc9659;hp=e586fdb81cfcca3289e85f441e7d9e6a6dcf736a;hpb=857523660ddabbf1e4bba1c6f5f322451991fa08;p=gnulib.git diff --git a/lib/ftell.c b/lib/ftell.c index e586fdb81..74ec986e2 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-2011 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,21 +20,15 @@ #include #include -/* Get off_t. */ -#include - -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif +#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;