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.
This is (now) also true for Linux.
- Suggested-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
- Signed-off-by: Werner Koch <wk@gnupg.org>