Signed-off-by: Yuriy Kolerov <[email protected]>
---
 libc/sysdeps/linux/common/fallocate.c   | 13 ++++++++-----
 libc/sysdeps/linux/common/fallocate64.c | 11 +++++++----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/libc/sysdeps/linux/common/fallocate.c 
b/libc/sysdeps/linux/common/fallocate.c
index b231226..97ac303 100644
--- a/libc/sysdeps/linux/common/fallocate.c
+++ b/libc/sysdeps/linux/common/fallocate.c
@@ -12,6 +12,7 @@
 #include <fcntl.h>
 #include <bits/kernel-features.h>
 #include <stdint.h>
+#include <errno.h>
 
 #if defined __NR_fallocate
 extern __typeof(fallocate) __libc_fallocate attribute_hidden;
@@ -26,17 +27,19 @@ int attribute_hidden __libc_fallocate(int fd, int mode, 
__off_t offset, __off_t
        uint32_t zero = 0;
        INTERNAL_SYSCALL_DECL(err);
        ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
-               __LONG_LONG_PAIR (zero, off_low),
-               __LONG_LONG_PAIR (zero, len_low)));
+               __LONG_LONG_PAIR(zero, off_low),
+               __LONG_LONG_PAIR(zero, len_low)));
 # elif __WORDSIZE == 64
        INTERNAL_SYSCALL_DECL(err);
        ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, mode, offset, 
len));
 # else
 # error your machine is neither 32 bit or 64 bit ... it must be magical
 # endif
-       if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
-               return INTERNAL_SYSCALL_ERRNO (ret, err);
-       return 0;
+       if (unlikely(INTERNAL_SYSCALL_ERROR_P(ret, err))) {
+               __set_errno(INTERNAL_SYSCALL_ERRNO(ret, err));
+               ret = -1;
+       }
+       return ret;
 }
 
 # if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
diff --git a/libc/sysdeps/linux/common/fallocate64.c 
b/libc/sysdeps/linux/common/fallocate64.c
index cf75693..d051d37 100644
--- a/libc/sysdeps/linux/common/fallocate64.c
+++ b/libc/sysdeps/linux/common/fallocate64.c
@@ -13,6 +13,7 @@
 #include <fcntl.h>
 #include <bits/kernel-features.h>
 #include <stdint.h>
+#include <errno.h>
 
 #if defined __NR_fallocate
 
@@ -26,10 +27,12 @@ int attribute_hidden __libc_fallocate64(int fd, int mode, 
__off64_t offset,
        int ret;
        INTERNAL_SYSCALL_DECL(err);
        ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
-               OFF64_HI_LO (offset), OFF64_HI_LO (len)));
-       if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
-               return INTERNAL_SYSCALL_ERRNO (ret, err);
-       return 0;
+               OFF64_HI_LO(offset), OFF64_HI_LO(len)));
+       if (unlikely(INTERNAL_SYSCALL_ERROR_P(ret, err))) {
+               __set_errno(INTERNAL_SYSCALL_ERRNO(ret, err));
+               ret = -1;
+       }
+       return ret;
 }
 
 #  if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
-- 
2.2.0

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to