This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Correct (f)truncate64 implementation



(f)truncate64 doesn't save errno, it might be changed to ENOSYS if
(f)truncate64 is not available but the syscalls are compiled in.

Andreas

1999-12-18  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/sysv/linux/ftruncate64.c (ftruncate64): Save and
	set errno.
	* sysdeps/unix/sysv/linux/truncate64.c (truncate64): Likewise.

============================================================
Index: sysdeps/unix/sysv/linux/ftruncate64.c
--- sysdeps/unix/sysv/linux/ftruncate64.c	1999/12/09 00:18:13	1.3
+++ sysdeps/unix/sysv/linux/ftruncate64.c	1999/12/18 11:01:07
@@ -43,6 +43,9 @@
     {
       unsigned int low = length & 0xffffffff;
       unsigned int high = length >> 32;
+#ifndef __ASSUME_TRUNCATE64_SYSCALL
+      int saved_errno = errno;
+#endif
       int result = INLINE_SYSCALL (ftruncate64, 3, fd, low, high);
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -51,6 +54,7 @@
 	return result;
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
+      __set_errno (saved_errno);
       have_no_ftruncate64 = 1;
 #endif
     }
============================================================
Index: sysdeps/unix/sysv/linux/truncate64.c
--- sysdeps/unix/sysv/linux/truncate64.c	1999/12/09 00:18:13	1.3
+++ sysdeps/unix/sysv/linux/truncate64.c	1999/12/18 11:01:07
@@ -43,6 +43,9 @@
     {
       unsigned int low = length & 0xffffffff;
       unsigned int high = length >> 32;
+#ifndef __ASSUME_TRUNCATE64_SYSCALL
+      int saved_errno = errno;
+#endif
       int result = INLINE_SYSCALL (truncate64, 3, path, low, high);
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -51,6 +54,7 @@
 	return result;
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
+      __set_errno (saved_errno);
       have_no_truncate64 = 1;
 #endif
     }

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]