[uclibc-ng-devel] [PATCH] lseek.c: bugfix ltp lseek01.c

Guo Ren ren_guo at c-sky.com
Fri Apr 13 10:24:41 CEST 2018


Ref the implement from the glibc and high=0 seems so bad.

Signed-off-by: Guo Ren <ren_guo at c-sky.com>
---
 libc/sysdeps/linux/common/lseek.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c
index 33df822..80d6931 100644
--- a/libc/sysdeps/linux/common/lseek.c
+++ b/libc/sysdeps/linux/common/lseek.c
@@ -19,8 +19,9 @@ off_t __NC(lseek)(int fd, off_t offset, int whence)
 {
 #if __WORDSIZE == 32
 	__off64_t result;
-	__off_t high = 0;
-	return INLINE_SYSCALL(llseek, 5, fd, high, offset, &result, whence) ?: result;
+	return INLINE_SYSCALL(llseek, 5, fd,
+			      (long) (((uint64_t) (offset)) >> 32),
+			      (long) offset, &result, whence) ?: result;
 #else
 	return lseek64(fd, offset, whence);
 #endif
-- 
2.7.4



More information about the devel mailing list