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

Message ID 1523607881-28837-1-git-send-email-ren_guo@c-sky.com
State New
Headers show
Series
  • [uclibc-ng-devel] lseek.c: bugfix ltp lseek01.c
Related show

Commit Message

Guo Ren April 13, 2018, 8:24 a.m.
Ref the implement from the glibc and high=0 seems so bad.

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

Comments

Waldemar Brodkorb April 13, 2018, 3:46 p.m. | #1
Hi Guo,
Guo Ren wrote,

> Ref the implement from the glibc and high=0 seems so bad.
> 
> Signed-off-by: Guo Ren <ren_guo@c-sky.com>

Applied and pushed,
 thx
  Waldemar

Patch

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