mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-13 15:20:07 +02:00
python3: handle negative errno on Haiku.
also enable _BSD_SOURCE for openpty declaration.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 174b88cd6fbb388545efb2e1218d13eb254defa8 Mon Sep 17 00:00:00 2001
|
||||
From 4f5d1b027f1e5b1bba2155aec103cec7233f9d7c Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Thu, 10 Apr 2014 16:03:33 +0000
|
||||
Subject: initial Haiku patch
|
||||
@@ -536,5 +536,43 @@ index f04bf22..718c03a 100644
|
||||
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
|
||||
libs = ['nsl']
|
||||
--
|
||||
2.10.2
|
||||
2.11.0
|
||||
|
||||
|
||||
From 7133afd2665e636cd11daadbaa672f1a45ed031e Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Sun, 16 Apr 2017 10:05:42 +0200
|
||||
Subject: fix for negative errnos
|
||||
|
||||
|
||||
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
|
||||
index 822ddb4..5334f2d 100644
|
||||
--- a/Lib/subprocess.py
|
||||
+++ b/Lib/subprocess.py
|
||||
@@ -1312,6 +1312,8 @@ class Popen(object):
|
||||
err_msg = err_msg.decode(errors="surrogatepass")
|
||||
if issubclass(child_exception_type, OSError) and hex_errno:
|
||||
errno_num = int(hex_errno, 16)
|
||||
+ if sys.platform.startswith('haiku'):
|
||||
+ errno_num = -errno_num;
|
||||
child_exec_never_called = (err_msg == "noexec")
|
||||
if child_exec_never_called:
|
||||
err_msg = ""
|
||||
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
|
||||
index 5007a39..625c507 100644
|
||||
--- a/Modules/_posixsubprocess.c
|
||||
+++ b/Modules/_posixsubprocess.c
|
||||
@@ -521,6 +521,10 @@ error:
|
||||
char *cur;
|
||||
_Py_write_noraise(errpipe_write, "OSError:", 8);
|
||||
cur = hex_errno + sizeof(hex_errno);
|
||||
+#ifdef __HAIKU__
|
||||
+ if (saved_errno < 0)
|
||||
+ saved_errno = -saved_errno;
|
||||
+#endif
|
||||
while (saved_errno != 0 && cur != hex_errno) {
|
||||
*--cur = Py_hexdigits[saved_errno % 16];
|
||||
saved_errno /= 16;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user