commit:     d66f4238e6b5dca2bbc0fb04f64c67f3e0bc3586
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 28 19:27:47 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 28 19:42:21 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d66f4238

pid-sandbox: handle EnvironmentError for python2 compat (bug 675868)

The fcntl.ioctl call raises IOError, which is different from OSError
for python2. Use EnvironmentError for compatibility.

Bug: https://bugs.gentoo.org/675868
Reported-by: Ivan Ivanich <ivanich <AT> ivanich.org.ua>
Fixes: ce0656337268 ("pid-sandbox: pid-ns-init TIOCSCTTY after setsid (bug 
675868)")
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/pid-ns-init | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/pid-ns-init b/bin/pid-ns-init
index d8e67cf6d..cfbd65280 100644
--- a/bin/pid-ns-init
+++ b/bin/pid-ns-init
@@ -80,7 +80,7 @@ def main(argv):
                if sys.stdout.isatty():
                        try:
                                fcntl.ioctl(sys.stdout, termios.TIOCSCTTY, 0)
-                       except OSError as e:
+                       except EnvironmentError as e:
                                if e.errno == errno.EPERM:
                                        # This means that stdout refers to the 
controlling terminal
                                        # of the parent process, and in this 
case we do not want to
@@ -101,7 +101,7 @@ def main(argv):
        while True:
                try:
                        pid, status = os.wait()
-               except OSError as e:
+               except EnvironmentError as e:
                        if e.errno == errno.EINTR:
                                continue
                        raise

Reply via email to