aboutsummaryrefslogtreecommitdiffstats
path: root/util/secmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/secmem.c')
-rw-r--r--util/secmem.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/util/secmem.c b/util/secmem.c
index 148ea1e88..c7fc597ee 100644
--- a/util/secmem.c
+++ b/util/secmem.c
@@ -32,6 +32,9 @@
#ifdef USE_CAPABILITIES
#include <sys/capability.h>
#endif
+ #ifdef HAVE_PLOCK
+ #include <sys/lock.h>
+ #endif
#endif
#include "types.h"
@@ -120,6 +123,13 @@ lock_pool( void *p, size_t n )
uid = getuid();
#ifdef HAVE_BROKEN_MLOCK
+ /* ick. but at least we get secured memory. about to lock
+ entire data segment. */
+ #ifdef HAVE_PLOCK
+ err = plock( DATLOCK );
+ if( err && errno )
+ err = errno;
+#else /*!HAVE_PLOCK*/
if( uid ) {
errno = EPERM;
err = errno;
@@ -129,6 +139,7 @@ lock_pool( void *p, size_t n )
if( err && errno )
err = errno;
}
+ #endif /*!HAVE_PLOCK*/
#else
err = mlock( p, n );
if( err && errno )