diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-03-14 17:51:24 +0530 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2013-03-14 22:27:19 +0100 |
commit | 1759f84c2a8c3dfd2705a2059754c4d0f1f8ca4b (patch) | |
tree | 3e1a58fedbd193793fd18711ffc4f8322d40f397 | |
parent | 58668975669a8549c52a8075cf4358203f0e613d (diff) |
leek: if lseek syscall is not available, use lseek64 even for !LFS
With Busybox and uClibc - both built w/o LFS, this caused ash to be
completely broken, as lseek was simply returning error.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r-- | libc/sysdeps/linux/common/lseek.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 26953ae66..500c6bf9d 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -15,11 +15,20 @@ # define __NR___lseek_nocancel __NR_lseek _syscall3(off_t, __NC(lseek), int, fd, off_t, offset, int, whence) /* Use lseek64 if __NR_lseek is not defined but UCLIBC_HAS_LFS is enabled */ -#elif !defined __NR_lseek && defined __NR_llseek \ - && __WORDSIZE == 32 && __UCLIBC_HAS_LFS__ +#elif !defined __NR_lseek && defined __NR_llseek +#include <endian.h> off_t __NC(lseek)(int fd, off_t offset, int whence) { +#if defined __UCLIBC_HAS_LFS__ return lseek64(fd, offset, whence); +#elif __WORDSIZE == 32 + __off64_t result; + __off_t high = 0; + return INLINE_SYSCALL(llseek, 5, fd, + __LONG_LONG_PAIR(high, offset), + &result, whence) ?: result; +#endif +/* No need to handle __WORDSIZE == 64 as such a kernel won't define __NR_llseek */ } #else # include <errno.h> |