public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Jaeger <aj@suse.de>
To: GNU libc hacker <libc-hacker@sourceware.cygnus.com>
Subject: Correct (f)truncate64 implementation
Date: Sat, 18 Dec 1999 03:05:00 -0000	[thread overview]
Message-ID: <u8wvqccy0w.fsf@gromit.rhein-neckar.de> (raw)

(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

                 reply	other threads:[~1999-12-18  3:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u8wvqccy0w.fsf@gromit.rhein-neckar.de \
    --to=aj@suse.de \
    --cc=libc-hacker@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).