diff options
author | Ron Yorston <rmy@pobox.com> | 2016-05-24 10:48:34 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-05-24 10:48:34 +0100 |
commit | 0d5f85b255e68385b4aa1b6b8c40ab4b7ad35125 (patch) | |
tree | 8c95da606bba2299f3b84dd266f931335fa5b64b /include/mingw.h | |
parent | 1f3a582db3ca7cd7f33d5ab6f2f6c46d68de689d (diff) | |
download | busybox-w32-0d5f85b255e68385b4aa1b6b8c40ab4b7ad35125.tar.gz busybox-w32-0d5f85b255e68385b4aa1b6b8c40ab4b7ad35125.tar.bz2 busybox-w32-0d5f85b255e68385b4aa1b6b8c40ab4b7ad35125.zip |
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.
Diffstat (limited to 'include/mingw.h')
-rw-r--r-- | include/mingw.h | 7 |
1 files changed, 4 insertions, 3 deletions
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); | |||
289 | #define mkdir mingw_mkdir | 289 | #define mkdir mingw_mkdir |
290 | #define chmod mingw_chmod | 290 | #define chmod mingw_chmod |
291 | 291 | ||
292 | #if ENABLE_LFS | 292 | #if ENABLE_LFS && !defined(__MINGW64_VERSION_MAJOR) |
293 | # define off_t off64_t | 293 | # define off_t off64_t |
294 | #endif | 294 | #endif |
295 | #undef lseek | ||
296 | #define lseek _lseeki64 | ||
297 | 295 | ||
298 | typedef int nlink_t; | 296 | typedef int nlink_t; |
299 | typedef int blksize_t; | 297 | typedef int blksize_t; |
@@ -388,6 +386,7 @@ NOIMPL(chroot,const char *root UNUSED_PARAM); | |||
388 | NOIMPL(fchdir,int fd UNUSED_PARAM); | 386 | NOIMPL(fchdir,int fd UNUSED_PARAM); |
389 | int mingw_dup2 (int fd, int fdto); | 387 | int mingw_dup2 (int fd, int fdto); |
390 | char *mingw_getcwd(char *pointer, int len); | 388 | char *mingw_getcwd(char *pointer, int len); |
389 | off_t mingw_lseek(int fd, off_t offset, int whence); | ||
391 | 390 | ||
392 | 391 | ||
393 | IMPL(getgid,int,DEFAULT_GID,void); | 392 | IMPL(getgid,int,DEFAULT_GID,void); |
@@ -428,6 +427,8 @@ int mingw_rmdir(const char *name); | |||
428 | #define open mingw_open | 427 | #define open mingw_open |
429 | #define unlink mingw_unlink | 428 | #define unlink mingw_unlink |
430 | #define rmdir mingw_rmdir | 429 | #define rmdir mingw_rmdir |
430 | #undef lseek | ||
431 | #define lseek mingw_lseek | ||
431 | 432 | ||
432 | #undef access | 433 | #undef access |
433 | #define access mingw_access | 434 | #define access mingw_access |