X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fftell.c;h=4ad13c9f486f1a5065a9365897a2c710806f1c8c;hb=5191b3546cfb6c163228c23f214e325ddf60d46f;hp=2bcc97edde2885a65d53d3192244844de33f0a32;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/lib/ftell.c b/lib/ftell.c index 2bcc97edd..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, 2008, 2009, 2010 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;