]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Sign extend offset.
authorUlrich Drepper <drepper@redhat.com>
Wed, 17 Jul 2002 20:44:33 +0000 (20:44 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 17 Jul 2002 20:44:33 +0000 (20:44 +0000)
sysdeps/unix/sysv/linux/mips/pread.c
sysdeps/unix/sysv/linux/mips/pwrite.c
sysdeps/unix/sysv/linux/pread.c
sysdeps/unix/sysv/linux/pwrite.c

index b1c1c0d8718b7a213ac254bd4e9bc2d2cbdafb1f..45305d2cccf92aebbef72d7f8460fd1ae1f8106d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <unistd.h>
 #include <endian.h>
@@ -48,8 +49,9 @@ __libc_pread (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
+  assert (sizeof (offset) == 4);
   result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-                          __LONG_LONG_PAIR (0, offset));
+                          __LONG_LONG_PAIR (offset >> 31, offset));
 # if __ASSUME_PREAD_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
index 40b2c8b23c761266e087f8848c7007c164d42a71..44f9d30ebfc8286f822f05ee0085078622f330ac 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <unistd.h>
 #include <endian.h>
@@ -47,8 +48,9 @@ __libc_pwrite (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
+  assert (sizeof (offset) == 4);
   result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-                          __LONG_LONG_PAIR (0, offset));
+                          __LONG_LONG_PAIR (offset >> 31, offset));
 # if __ASSUME_PWRITE_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
index da664887fedcc10062497723dc5d38ea08e93e22..2d5af618ac8f7571e66689679455ec34312400fb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <endian.h>
 #include <unistd.h>
@@ -49,8 +50,9 @@ __libc_pread (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
+  assert (sizeof (offset) == 4);
   result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count,
-                          __LONG_LONG_PAIR (0, offset));
+                          __LONG_LONG_PAIR (offset >> 31, offset));
 # if __ASSUME_PREAD_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
index ceafef838a79e22ed56a02d867b9d3ef34104bc4..6a68adcdbd6bbfb64d510c67a9f0f5f1887c888a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <endian.h>
 #include <unistd.h>
@@ -49,8 +50,9 @@ __libc_pwrite (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
+  assert (sizeof (offset) == 4);
   result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count,
-                          __LONG_LONG_PAIR (0, offset));
+                          __LONG_LONG_PAIR (offset >> 31, offset));
 # if __ASSUME_PWRITE_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */