[tor-commits] [tor/master] Return 0 when detecting the amount of memory fails

nickm at torproject.org nickm at torproject.org
Tue Feb 10 06:40:46 UTC 2015


commit 9ae321db66cf83453b34c75d889599ea4a75642b
Author: Matthew Finkel <Matthew.Finkel at gmail.com>
Date:   Mon Feb 9 01:58:22 2015 +0000

    Return 0 when detecting the amount of memory fails
    
    Fixes bug 14802;  bugfix on 0.2.5.4-alpha.
---
 changes/bug14802    |    4 ++++
 src/common/compat.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/changes/bug14802 b/changes/bug14802
new file mode 100644
index 0000000..fc7cfd1
--- /dev/null
+++ b/changes/bug14802
@@ -0,0 +1,4 @@
+  o Minor bugfix:
+    - Make an educated guess about how much memory the system has when our
+      detection functionality fails on some operating system.  Fixes bug 14802;
+      bugfix on 0.2.5.4-alpha.
diff --git a/src/common/compat.c b/src/common/compat.c
index e25ecc4..3eda1ca 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -3517,7 +3517,7 @@ get_total_system_memory_impl(void)
   size_t len = sizeof(memsize);
   int mib[2] = {CTL_HW, HW_USERMEM};
   if (sysctl(mib,2,&memsize,&len,NULL,0))
-    return -1;
+    return 0;
 
   return memsize;
 





More information about the tor-commits mailing list