[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Processing proc stat files with more than 44 entries
commit 6aa207434661434984a7ea5b8cf3d2ab013dea69
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Jul 7 20:14:19 2012 -0700
Processing proc stat files with more than 44 entries
A long-standing arm and stem bug is that it checks if '/proc/<pid>/stat'
contains exactly 44 elements and, if not, refuses to parse it. This is a
mistake, stat files may have more entries depending on the platform. Changing
the check to account for this.
---
stem/util/proc.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/stem/util/proc.py b/stem/util/proc.py
index 26048df..a57e351 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -232,7 +232,7 @@ def get_stats(pid, *stat_types):
stat_comp.append(stat_line[cmd_start + 1:cmd_end])
stat_comp += stat_line[cmd_end + 1:].split()
- if len(stat_comp) != 44 and _is_float(stat_comp[13], stat_comp[14], stat_comp[21]):
+ if len(stat_comp) < 44 and _is_float(stat_comp[13], stat_comp[14], stat_comp[21]):
exc = IOError("stat file had an unexpected format: %s" % stat_path)
_log_failure(parameter, exc)
raise exc
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits