summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-12-09 12:10:54 +0100
committerWerner Koch <wk@gnupg.org>2016-12-09 12:10:54 +0100
commit618b8978f46f4011c11512fd5f30c15e01652e2e (patch)
treea1e669656746e3d22273b3b69b96267b29a47fb1 /acinclude.m4
parent656395ba4cf34f42dda3a120bda3ed1220755a3d (diff)
downloadlibgcrypt-618b8978f46f4011c11512fd5f30c15e01652e2e.tar.gz
Improve handling of mlock error codes.
* acinclude.m4 (GNUPG_CHECK_MLOCK): Check also for EAGAIN which is a legitimate return code and does not indicate a broken mlock(). * src/secmem.c (lock_pool_pages): Test ERR instead of ERRNO which could have been overwritten by cap_from+text et al. -- On FreeBSD, if there are not enough free pages, mlock() can return EAGAIN, as documented in mlock(2). That doesn't mean that mlock is broken. I suspect this same issue also exists on the other BSD's. Suggested-by: Ruben Kerkhof <ruben@rubenkerkhof.com> This is (now) also true for Linux. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m42
1 files changed, 1 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 96be8330..90b3cb96 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -242,7 +242,7 @@ int main()
pool += (pgsize - ((long int)pool % pgsize));
err = mlock( pool, 4096 );
- if( !err || errno == EPERM )
+ if( !err || errno == EPERM || errno == EGAIN)
return 0; /* okay */
return 1; /* hmmm */