aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-04-08 15:44:55 -0700
committerPetr Baudis <pasky@ucw.cz>2010-05-12 03:21:16 +0200
commit1aa9c16a2a1b297b31793b99cc3d5d67e720edb2 (patch)
treedba586a225b3c38547fbc2e088b9a93b18dd6016
parent6b6e2d505cf6e9246872e7f98e338b52922c7b33 (diff)
downloadglibc-1aa9c16a2a1b297b31793b99cc3d5d67e720edb2.zip
glibc-1aa9c16a2a1b297b31793b99cc3d5d67e720edb2.tar.gz
glibc-1aa9c16a2a1b297b31793b99cc3d5d67e720edb2.tar.bz2
Fix fallocate error return on i386.
(cherry picked from commit de240a05b3638879af2f9ab663c56ad8b26b1ad3)
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate64.c8
3 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e2a23b7..1339765 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-07 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/unix/sysv/linux/i386/fallocate.c: Set errno on error.
+ * sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
+
2009-12-01 Eric Blake <ebb9@byu.net>
[BZ #11039]
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate.c b/sysdeps/unix/sysv/linux/i386/fallocate.c
index 14e7883..1434a83 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate.c
@@ -30,7 +30,13 @@ int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
- return __call_fallocate (fd, mode, offset, len);
+ int err = __call_fallocate (fd, mode, offset, len);
+ if (__builtin_expect (err, 0))
+ {
+ __set_errno (err);
+ err = -1;
+ }
+ return err;
#else
__set_errno (ENOSYS);
return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c
index 85f315c..063bab0 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c
@@ -30,7 +30,13 @@ int
fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
{
#ifdef __NR_fallocate
- return __call_fallocate (fd, mode, offset, len);
+ int err = __call_fallocate (fd, mode, offset, len);
+ if (__builtin_expect (err, 0))
+ {
+ __set_errno (err);
+ err = -1;
+ }
+ return err;
#else
__set_errno (ENOSYS);
return -1;