[yum-commits] needs-restarting.py

James Antill james at osuosl.org
Mon Jul 23 13:57:27 UTC 2012


 needs-restarting.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit fcdeaf5517e0773ecf00955f7a5450784bb045f6
Author: James Antill <james at and.org>
Date:   Mon Jul 23 09:55:13 2012 -0400

    Do the .readlines() within the try, so we catch the EPERM exception.
    Welcome to the new unix.

diff --git a/needs-restarting.py b/needs-restarting.py
index 0b54e63..a6946b0 100755
--- a/needs-restarting.py
+++ b/needs-restarting.py
@@ -77,12 +77,12 @@ def get_open_files(pid):
     files = []
     smaps = '/proc/%s/smaps' % pid
     try:
-        maps = open(smaps, 'r')
+        maps = open(smaps, 'r').readlines()
     except (IOError, OSError), e:
         print "Could not open %s" % smaps
         return files
 
-    for line in maps.readlines():
+    for line in maps:
         slash = line.find('/')
         if slash == -1 or line.find('00:') != -1: # if we don't have a '/' or if we fine 00: in the file then it's not _REALLY_ a file
             continue


More information about the Yum-commits mailing list