Browse Source

Carmelo AMOROSO writes:
running LTP test suite on uClibc-nptl for sh4 I found a bug into pread
and pwrite functions. When the offset is negative it is not correctly
handled due to a missing shift operation, so it is passed to the
syscall as the highest unsigned positive value.

Mike Frysinger 18 years ago
parent
commit
f2c7b37096
1 changed files with 2 additions and 2 deletions
  1. 2 2
      libc/sysdeps/linux/sh/pread_write.c

+ 2 - 2
libc/sysdeps/linux/sh/pread_write.c

@@ -33,7 +33,7 @@ static inline _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
 
 ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
 {
-	return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR((off_t)0,offset)));
+	return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)));
 }
 weak_alias(__libc_pread,pread)
 
@@ -66,7 +66,7 @@ static inline _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
 
 ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
 {
-	return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR((off_t)0,offset)));
+	return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset >> 31,offset)));
 }
 weak_alias(__libc_pwrite,pwrite)