From 0d5f85b255e68385b4aa1b6b8c40ab4b7ad35125 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 24 May 2016 10:48:34 +0100 Subject: win32: return an error when lseek is applied to a pipe tail failed to process input from a pipe correctly: $ echo -n 54321 | tail -c 3 543 It was trying to use lseek as an optimisation but WIN32 lseek doesn't return an error whan applied to a pipe. Fix this by providing a wrapper for lseek. --- include/mingw.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/mingw.h') diff --git a/include/mingw.h b/include/mingw.h index efb17e137..04700963c 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -289,11 +289,9 @@ int mingw_chmod(const char *path, int mode); #define mkdir mingw_mkdir #define chmod mingw_chmod -#if ENABLE_LFS +#if ENABLE_LFS && !defined(__MINGW64_VERSION_MAJOR) # define off_t off64_t #endif -#undef lseek -#define lseek _lseeki64 typedef int nlink_t; typedef int blksize_t; @@ -388,6 +386,7 @@ NOIMPL(chroot,const char *root UNUSED_PARAM); NOIMPL(fchdir,int fd UNUSED_PARAM); int mingw_dup2 (int fd, int fdto); char *mingw_getcwd(char *pointer, int len); +off_t mingw_lseek(int fd, off_t offset, int whence); IMPL(getgid,int,DEFAULT_GID,void); @@ -428,6 +427,8 @@ int mingw_rmdir(const char *name); #define open mingw_open #define unlink mingw_unlink #define rmdir mingw_rmdir +#undef lseek +#define lseek mingw_lseek #undef access #define access mingw_access -- cgit v1.2.3-55-g6feb