summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/posix_madvise.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-07-10 13:42:53 +0000
committerguenther <guenther@openbsd.org>2014-07-10 13:42:53 +0000
commit228d32200194209ef31f85d91a4f4da3083f4bc7 (patch)
treef3cf8a6e9d734e051f624ac982f775dd76fcb012 /lib/libc/sys/posix_madvise.c
parentFewer lies, also do not document DES_3cbc_encrypt anymore. (diff)
downloadwireguard-openbsd-228d32200194209ef31f85d91a4f4da3083f4bc7.tar.xz
wireguard-openbsd-228d32200194209ef31f85d91a4f4da3083f4bc7.zip
posix_madvise() should return the errno value on error, not -1
ok tedu@ jmc@
Diffstat (limited to 'lib/libc/sys/posix_madvise.c')
-rw-r--r--lib/libc/sys/posix_madvise.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/sys/posix_madvise.c b/lib/libc/sys/posix_madvise.c
index be310dbd7df..153c28223d1 100644
--- a/lib/libc/sys/posix_madvise.c
+++ b/lib/libc/sys/posix_madvise.c
@@ -1,13 +1,14 @@
-/* $OpenBSD: posix_madvise.c,v 1.2 2014/07/10 12:46:28 tedu Exp $ */
+/* $OpenBSD: posix_madvise.c,v 1.3 2014/07/10 13:42:53 guenther Exp $ */
/*
* Ted Unangst wrote this file and placed it into the public domain.
*/
#include <sys/mman.h>
+#include <errno.h>
int _thread_sys_madvise(void *addr, size_t len, int behav);
int
posix_madvise(void *addr, size_t len, int behav)
{
- return (_thread_sys_madvise(addr, len, behav));
+ return (_thread_sys_madvise(addr, len, behav) ? errno : 0);
}