Make the reading of /proc/<pid>/fd/ impervious to the possible addition
authorJason Stubbs <jstubbs@gentoo.org>
Sun, 2 Apr 2006 08:05:36 +0000 (08:05 -0000)
committerJason Stubbs <jstubbs@gentoo.org>
Sun, 2 Apr 2006 08:05:36 +0000 (08:05 -0000)
of non-numerically named entries.

svn path=/main/trunk/; revision=3055

pym/portage_exec.py

index e800376dcfd5e6c0728e64a677f91059c4c6fd6f..4f7fef2b9c31934946408aa00461ffef081a4d44 100644 (file)
@@ -19,7 +19,7 @@ except ImportError:
 
 if os.path.isdir("/proc/%i/fd" % os.getpid()):
        def get_open_fds():
-               return map(int, os.listdir("/proc/%i/fd" % os.getpid()))
+               return map(int, [fd for fd in os.listdir("/proc/%i/fd" % os.getpid()) if fd.isdigit()])
 else:
        def get_open_fds():
                return xrange(max_fd_limit)