projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* lib/stdint_.h: Fix typo: _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H was
[gnulib.git]
/
lib
/
ftello.c
diff --git
a/lib/ftello.c
b/lib/ftello.c
index
7054dd5
..
3edc0fb
100644
(file)
--- a/
lib/ftello.c
+++ b/
lib/ftello.c
@@
-20,14
+20,24
@@
/* Specification. */
#include <stdio.h>
/* Specification. */
#include <stdio.h>
+/* Get lseek. */
+#include <unistd.h>
+
#undef ftello
#if !HAVE_FTELLO
#undef ftello
#if !HAVE_FTELLO
+# undef ftell
# define ftello ftell
#endif
off_t
rpl_ftello (FILE *fp)
{
# 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)
{
#if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{