commit b56b9c627332208913b91357c02267c472644fe9 Author: Damian Johnson atagar@torproject.org Date: Fri Dec 30 10:12:57 2011 -0800
Only issuing WARN for get_bsd_jail_id on FreeBSD
The stem.util.system.get_bsd_jail_id() function is only available on FreeBSD (and maybe OSX) so only issuing a warning for failures on that platform. Everywhere else this now gives a DEBUG level message to warn the developer that the function's unsupported. --- stem/util/system.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/stem/util/system.py b/stem/util/system.py index 8d4708e..bb50093 100644 --- a/stem/util/system.py +++ b/stem/util/system.py @@ -484,7 +484,15 @@ def get_bsd_jail_id(pid): jid = ps_output[1].strip() if jid.isdigit(): return int(jid)
- LOGGER.warn("Failed to figure out the FreeBSD jail id. Assuming 0.") + # TODO: Is this function exclusive to FreeBSD or does it work on other BSD + # systems? It should fail on OpenBSD but might work on OSX. + + os_name = os.uname()[0] + if os_name == "FreeBSD": + LOGGER.warn("Failed to figure out the FreeBSD jail id for pid %s. Guessing that it's not in a jail." % pid) + else: + LOGGER.debug("get_bsd_jail_id(%s): this function isn't supported on %s" % (pid, os_name)) + return 0
def is_relative_path(path):
tor-commits@lists.torproject.org