diff options
Diffstat (limited to 'libio/fileops.c')
-rw-r--r-- | libio/fileops.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libio/fileops.c b/libio/fileops.c index a59e248..0cce828 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -928,6 +928,16 @@ do_ftell (FILE *fp) if (result == EOF) return result; + if (result == 0 && offset < 0) + { + /* This happens for some character devices that always report + file offset 0 even after some data has been read (instead of + failing with ESPIPE). The fclose path ignores this + error. */ + __set_errno (ESPIPE); + return EOF; + } + result += offset; if (result < 0) |