1 |
commit: d66f4238e6b5dca2bbc0fb04f64c67f3e0bc3586 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 28 19:27:47 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 28 19:42:21 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d66f4238 |
7 |
|
8 |
pid-sandbox: handle EnvironmentError for python2 compat (bug 675868) |
9 |
|
10 |
The fcntl.ioctl call raises IOError, which is different from OSError |
11 |
for python2. Use EnvironmentError for compatibility. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/675868 |
14 |
Reported-by: Ivan Ivanich <ivanich <AT> ivanich.org.ua> |
15 |
Fixes: ce0656337268 ("pid-sandbox: pid-ns-init TIOCSCTTY after setsid (bug 675868)") |
16 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
17 |
|
18 |
bin/pid-ns-init | 4 ++-- |
19 |
1 file changed, 2 insertions(+), 2 deletions(-) |
20 |
|
21 |
diff --git a/bin/pid-ns-init b/bin/pid-ns-init |
22 |
index d8e67cf6d..cfbd65280 100644 |
23 |
--- a/bin/pid-ns-init |
24 |
+++ b/bin/pid-ns-init |
25 |
@@ -80,7 +80,7 @@ def main(argv): |
26 |
if sys.stdout.isatty(): |
27 |
try: |
28 |
fcntl.ioctl(sys.stdout, termios.TIOCSCTTY, 0) |
29 |
- except OSError as e: |
30 |
+ except EnvironmentError as e: |
31 |
if e.errno == errno.EPERM: |
32 |
# This means that stdout refers to the controlling terminal |
33 |
# of the parent process, and in this case we do not want to |
34 |
@@ -101,7 +101,7 @@ def main(argv): |
35 |
while True: |
36 |
try: |
37 |
pid, status = os.wait() |
38 |
- except OSError as e: |
39 |
+ except EnvironmentError as e: |
40 |
if e.errno == errno.EINTR: |
41 |
continue |
42 |
raise |