diff options
author | kib <kib@FreeBSD.org> | 2014-02-06 19:47:17 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-02-06 19:47:17 +0000 |
commit | ce48f3b35de8eeff2a37ad55803ef0e4c57a7f05 (patch) | |
tree | 5604fb1ed8b1e338d7fdf6a9c639512583952e1e /lib/libc/gen | |
parent | 88938f44a008c777d8811442d0121c4edd7c943d (diff) | |
download | FreeBSD-src-ce48f3b35de8eeff2a37ad55803ef0e4c57a7f05.zip FreeBSD-src-ce48f3b35de8eeff2a37ad55803ef0e4c57a7f05.tar.gz |
MFC r261080:
The posix_fallocate(2) syscall should return error number on error,
without modifying errno.
MFC r261290:
The posix_madvise(3) and posix_fadvise(2) should return error on
failure, same as posix_fallocate(2).
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/pmadvise.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libc/gen/pmadvise.c b/lib/libc/gen/pmadvise.c index 60cef63..0dc77e3 100644 --- a/lib/libc/gen/pmadvise.c +++ b/lib/libc/gen/pmadvise.c @@ -8,9 +8,19 @@ __FBSDID("$FreeBSD$"); #include <sys/mman.h> +#include <errno.h> int posix_madvise(void *address, size_t size, int how) { - return madvise(address, size, how); + int ret, saved_errno; + + saved_errno = errno; + if (madvise(address, size, how) == -1) { + ret = errno; + errno = saved_errno; + } else { + ret = 0; + } + return (ret); } |