summaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-11-20 13:28:16 -0500
committerNick Mathewson <nickm@torproject.org>2009-11-20 13:28:16 -0500
commit444eff62862551fd984b8173ecb174483d7dbb7b (patch)
treed84930a9fba4a5118a90b30049e217cc1292e65f /src/common/compat.c
parent1ee580407ccb91304cf7ae24c0d809f57e6b4ccc (diff)
downloadtor-444eff62862551fd984b8173ecb174483d7dbb7b.tar.gz
tor-444eff62862551fd984b8173ecb174483d7dbb7b.zip
Fix compilation on OSX 10.3.
On this OSX version, there is a stub mlockall() function that doesn't work, *and* the declaration for it is hidden by an '#ifdef _P1003_1B_VISIBLE'. This would make autoconf successfully find the function, but our code fail to build when no declaration was found. This patch adds an additional test for the declaration.
Diffstat (limited to 'src/common/compat.c')
-rw-r--r--src/common/compat.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 96012e2e01..4fc44afac9 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2258,7 +2258,6 @@ int
tor_mlockall(void)
{
static int memory_lock_attempted = 0;
- int ret;
if (memory_lock_attempted) {
return 1;
@@ -2273,15 +2272,13 @@ tor_mlockall(void)
* http://msdn.microsoft.com/en-us/library/aa366895(VS.85).aspx
*/
-#ifdef HAVE_MLOCKALL
- ret = tor_set_max_memlock();
- if (ret == 0) {
+#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL
+ if (tor_set_max_memlock() == 0) {
/* Perhaps we only want to log this if we're in a verbose mode? */
log_notice(LD_GENERAL, "RLIMIT_MEMLOCK is now set to RLIM_INFINITY.");
}
- ret = mlockall(MCL_CURRENT|MCL_FUTURE);
- if (ret == 0) {
+ if (mlockall(MCL_CURRENT|MCL_FUTURE) == 0) {
log_notice(LD_GENERAL, "Insecure OS paging is effectively disabled.");
return 0;
} else {