diff options
author | Nobuyoshi Nakada <[email protected]> | 2019-07-25 06:39:40 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2019-07-25 06:39:40 +0900 |
commit | 0a63c4d5fbbbfae9aba92c78e39b1521b90f1b06 (patch) | |
tree | 4f7c8613455358cfb977c315ad030f8b24a44bdb /win32/win32.c | |
parent | efa380b006aeafbad90b2d4e795a602404fec3c5 (diff) |
Fix errno at seeking socket/pipe on Windows
[Bug #12230]
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 11 |
1 files changed, 11 insertions, 0 deletions
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) |