aboutsummaryrefslogtreecommitdiff
path: root/whatmaps
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-06-26 22:39:19 +0200
committerGuido Günther <agx@sigxcpu.org>2011-06-26 22:40:26 +0200
commit3fe70945a002917803e71dfc3e7cc08e0d435d87 (patch)
tree4cad3f39d4f59c57308832fde3dd561259cdd83e /whatmaps
parent18158e17898e3359de42893c18ee93b305473826 (diff)
Check for deleted binaries before trying to stat them
Diffstat (limited to 'whatmaps')
-rwxr-xr-xwhatmaps11
1 files changed, 5 insertions, 6 deletions
diff --git a/whatmaps b/whatmaps
index 66bcf7c..a5c6a8b 100755
--- a/whatmaps
+++ b/whatmaps
@@ -47,13 +47,12 @@ class Process(object):
self.mapped = []
try:
self.exe = os.readlink('/proc/%d/exe' % self.pid)
+ m = self.deleted_re.match(self.exe)
+ if m:
+ self.exe = m.group('exe')
+ logging.debug("Using deleted exe %s", self.exe)
if not os.path.exists(self.exe):
- m = self.deleted_re.match(self.exe)
- if m:
- self.exe = m.group('exe')
- logging.debug("Using deleted exe %s", self.exe)
- else:
- logging.debug("%s doesn't exist", self.exe)
+ logging.debug("%s doesn't exist", self.exe)
self.cmdline = open('/proc/%d/cmdline' % self.pid).read()
except OSError:
self.exe = None