about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/ftruncate64.c
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-05-26 20:11:43 +0000
committerAndreas Jaeger <aj@suse.de>2000-05-26 20:11:43 +0000
commit1869e7d1341a3c01b5aa0d231e4708c35e374b83 (patch)
treee0e61c3f053a603d6400228735c5fddcc9766d7e /sysdeps/unix/sysv/linux/ftruncate64.c
parentf0b2767b75f31e04f2c22260b857595f081e748d (diff)
downloadglibc-1869e7d1341a3c01b5aa0d231e4708c35e374b83.tar.gz
glibc-1869e7d1341a3c01b5aa0d231e4708c35e374b83.tar.xz
glibc-1869e7d1341a3c01b5aa0d231e4708c35e374b83.zip
* sysdeps/unix/sysv/linux/ftruncate64.c (ftruncate64): Make order
of arguments dependend on endianness. 
* sysdeps/unix/sysv/linux/truncate64.c: Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/ftruncate64.c')
-rw-r--r--sysdeps/unix/sysv/linux/ftruncate64.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index a38d5bd560..40e28790eb 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -18,6 +18,7 @@
 
 #include <sys/types.h>
 #include <errno.h>
+#include <endian.h>
 #include <unistd.h>
 
 #include <sysdep.h>
@@ -31,14 +32,13 @@
 extern int __have_no_truncate64;
 #endif
 
+/* The order of hight, low depends on endianness.  */
 extern int __syscall_ftruncate64 (int fd, int high_length, int low_length);
 
 
 /* Truncate the file FD refers to to LENGTH bytes.  */
 int
-ftruncate64 (fd, length)
-     int fd;
-     off64_t length;
+ftruncate64 (int fd, off64_t length)
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
   if (! __have_no_truncate64)
@@ -49,8 +49,11 @@ ftruncate64 (fd, length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
+#if __BYTE_ORDER == __LITTLE_ENDIAN
       int result = INLINE_SYSCALL (ftruncate64, 3, fd, low, high);
-
+#elif __BYTE_ORDER == __BIG_ENDIAN
+      int result = INLINE_SYSCALL (ftruncate64, 3, fd, high, low);
+#endif
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)
 #endif