X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fftello.c;h=3edc0fb963e16e4e4ba63fa52e89fb0a38f7a596;hb=6c1b57f5d397d3d8c3212fc3f4c91faf64bf0654;hp=7054dd5b2a1dcfa4692d137cbd6a1ffc926a4324;hpb=cec93e99d19f54c8f310b8290bab9014891530e3;p=gnulib.git diff --git a/lib/ftello.c b/lib/ftello.c index 7054dd5b2..3edc0fb96 100644 --- a/lib/ftello.c +++ b/lib/ftello.c @@ -20,14 +20,24 @@ /* Specification. */ #include +/* Get lseek. */ +#include + #undef ftello #if !HAVE_FTELLO +# undef ftell # define ftello ftell #endif off_t rpl_ftello (FILE *fp) { +#if LSEEK_PIPE_BROKEN + /* mingw gives bogus answers rather than failure on non-seekable files. */ + if (lseek (fileno (fp), 0, SEEK_CUR) == -1) + return -1; +#endif + #if defined __SL64 && defined __SCLE /* Cygwin */ if ((fp->_flags & __SL64) == 0) {