From: Zac Medico Date: Tue, 25 Jun 2013 07:48:18 +0000 (-0700) Subject: Use /proc/self/fd for solaris compat, bug #474536 X-Git-Tag: v2.2.0_alpha186~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d74ef62ae6509bad2d1a02d26a69dd4de511b87c;p=portage.git Use /proc/self/fd for solaris compat, bug #474536 --- diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh index eb6066f7a..ecd78c3f3 100644 --- a/bin/helper-functions.sh +++ b/bin/helper-functions.sh @@ -77,9 +77,9 @@ __redirect_alloc_fd() { # Need to provide the functionality ourselves. local fd=10 local fddir=/dev/fd - # Use /proc//fd if available (/dev/fd + # Prefer /proc/self/fd if available (/dev/fd # doesn't work on solaris, see bug #474536). - [[ -d /proc/${BASHPID}/fd ]] && fddir=/proc/${BASHPID}/fd + [[ -d /proc/self/fd ]] && fddir=/proc/self/fd while :; do # Make sure the fd isn't open. It could be a char device, # or a symlink (possibly broken) to something else. diff --git a/pym/portage/process.py b/pym/portage/process.py index 6969370d2..7fdc1333a 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -31,15 +31,15 @@ except ImportError: if sys.hexversion >= 0x3000000: basestring = str -for _fd_dir in ("/dev/fd", "/proc/self/fd"): +# Prefer /proc/self/fd if available (/dev/fd +# doesn't work on solaris, see bug #474536). +for _fd_dir in ("/proc/self/fd", "/dev/fd"): if os.path.isdir(_fd_dir): break else: _fd_dir = None -# Use /proc//fd for SunOS (/dev/fd -# doesn't work on solaris, see bug #474536). -if _fd_dir is not None and platform.system() not in ('SunOS',): +if _fd_dir is not None: def get_open_fds(): return (int(fd) for fd in os.listdir(_fd_dir) if fd.isdigit())