about summary refs log tree commit diff
path: root/src/stdio/__stdio_seek.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/__stdio_seek.c')
-rw-r--r--src/stdio/__stdio_seek.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdio/__stdio_seek.c b/src/stdio/__stdio_seek.c
index c205ab82..35ae788c 100644
--- a/src/stdio/__stdio_seek.c
+++ b/src/stdio/__stdio_seek.c
@@ -2,6 +2,7 @@
 
 static off_t retneg1(FILE *f, off_t off, int whence)
 {
+	errno = ESPIPE;
 	return -1;
 }
 
@@ -15,7 +16,6 @@ off_t __stdio_seek(FILE *f, off_t off, int whence)
 	ret = syscall(SYS_lseek, f->fd, off, whence);
 #endif
 	/* Detect unseekable files and optimize future failures out */
-	if (ret < 0 && off == 0 && whence == SEEK_CUR)
-		f->seek = retneg1;
+	if (ret < 0 && errno == ESPIPE) f->seek = retneg1;
 	return ret;
 }