[tor-bugs] #14802 [Tor]: Return 0 when we fail to get the amount of system memory on some obscure OS

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Feb 9 01:38:49 UTC 2015


#14802: Return 0 when we fail to get the amount of system memory on some obscure OS
--------------------+------------------------------------
 Reporter:  sysrqb  |          Owner:
     Type:  defect  |         Status:  new
 Priority:  normal  |      Milestone:
Component:  Tor     |        Version:  Tor: 0.2.5.4-alpha
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
--------------------+------------------------------------
 Currently we incorrectly return -1 when sysctl fails in
 {{{
 #elif defined(HAVE_SYSCTL) && defined(HW_PHYSMEM)
   /* On some systems (like FreeBSD I hope) you can use a size_t with
    * HW_PHYSMEM. */
   size_t memsize=0;
   size_t len = sizeof(memsize);
   int mib[2] = {CTL_HW, HW_USERMEM};
   if (sysctl(mib,2,&memsize,&len,NULL,0))
     return -1;

   return memsize;
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14802>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list