libc: posix_fallocate must return an error number on failure
commit9fae2ad9937279c9f7f40975ac14cb7b57f4a36d
authorYuriy Kolerov <yuriy.kolerov@synopsys.com>
Wed, 23 Sep 2015 12:43:39 +0000 (23 15:43 +0300)
committerWaldemar Brodkorb <wbx@openadk.org>
Mon, 5 Oct 2015 20:07:08 +0000 (5 22:07 +0200)
tree670781363cabeb335c490ee1f47e305b9bbf3a33
parent4480f9b5558906fce2c35f1819d4e1fe5922a9fa
libc: posix_fallocate must return an error number on failure

posix_fallocate implementation in uClibc relies on fallocate
system call - it just returns what fallocate returns. However
fallocate returns -1 on failure and assigns an error number
to errno variable. In the same time posix_fallocate must
return an error number but not -1.

What does this patch: if fallocate returns -1 then posix_fallocate
returns errno. Otherwise posix_fallocate returns 0 on success.

However there is a side effect - posix_fallocate sets errno on
failure because fallocate does it. But POSIX does not forbid it
thus it's not a problem.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
libc/sysdeps/linux/common/posix_fallocate.c
libc/sysdeps/linux/common/posix_fallocate64.c