diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 4 | ||||
-rw-r--r-- | util/secmem.c | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 3e361bcdb..c70c28596 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -13,6 +13,10 @@ * memory.c [__riscos__]: Minor patches * riscos.c (set_filetype): New. + * secmem.c (lock_pool): Under HPUX mlock is broken but we might + have plock, so we use this to lock the entire process. By Albert + Chin. + 2001-07-03 Werner Koch <[email protected]> * strgutil.c (utf8_to_native): Fixed printing of invalid utf-8 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 ) |