From 0a63c4d5fbbbfae9aba92c78e39b1521b90f1b06 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 25 Jul 2019 06:39:40 +0900 Subject: Fix errno at seeking socket/pipe on Windows [Bug #12230] --- win32/win32.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index d28bd56452..825b42399c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5845,6 +5845,17 @@ rb_w32_lstati128(const char *path, struct stati128 *st) return w32_stati128(path, st, filecp(), TRUE); } +off_t +rb_w32_lseek(int fd, off_t ofs, int whence) +{ + SOCKET sock = TO_SOCKET(fd); + if (is_socket(sock) || is_pipe(sock)) { + errno = ESPIPE; + return -1; + } + return _lseeki64(fd, ofs, whence); +} + /* License: Ruby's */ int rb_w32_access(const char *path, int mode) -- cgit v1.2.3