lbry-android-sdk/p4a/pythonforandroid/recipes/python2legacy/patches/disable-openpty.patch
Akinwale Ariwodola 8b2694efb7
New build (#508)
* fix build for openssl 1.1.1b required for sdk
(cherry picked from commit aa49e3b2755b97b6331cdbbb89efc954de8d5977)

* use js code from master

* fix openssl recipe and tweak build
(cherry picked from commit 6e94c27021c7bd7b1e880c2fc314850e36a5a38e)

* remove unused build recipes
(cherry picked from commit f5c0577bdb175bfc0990602936bbc9e2052e1f25)
2019-03-30 21:58:45 +01:00

59 lines
1.9 KiB
Diff

--- python2/Modules/posixmodule.c 2016-01-05 15:54:39.504651722 -0600
+++ b/Modules/posixmodule.c 2016-01-05 16:01:48.072559330 -0600
@@ -3743,54 +3743,8 @@
static PyObject *
posix_openpty(PyObject *self, PyObject *noargs)
{
- int master_fd, slave_fd;
-#ifndef HAVE_OPENPTY
- char * slave_name;
-#endif
-#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY)
- PyOS_sighandler_t sig_saved;
-#ifdef sun
- extern char *ptsname(int fildes);
-#endif
-#endif
-
-#ifdef HAVE_OPENPTY
- if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
- return posix_error();
-#elif defined(HAVE__GETPTY)
- slave_name = _getpty(&master_fd, O_RDWR, 0666, 0);
- if (slave_name == NULL)
- return posix_error();
-
- slave_fd = open(slave_name, O_RDWR);
- if (slave_fd < 0)
- return posix_error();
-#else
- master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */
- if (master_fd < 0)
- return posix_error();
- sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL);
- /* change permission of slave */
- if (grantpt(master_fd) < 0) {
- PyOS_setsig(SIGCHLD, sig_saved);
- return posix_error();
- }
- /* unlock slave */
- if (unlockpt(master_fd) < 0) {
- PyOS_setsig(SIGCHLD, sig_saved);
- return posix_error();
- }
- PyOS_setsig(SIGCHLD, sig_saved);
- slave_name = ptsname(master_fd); /* get name of slave */
- if (slave_name == NULL)
- return posix_error();
- slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */
- if (slave_fd < 0)
- return posix_error();
-#endif /* HAVE_OPENPTY */
-
- return Py_BuildValue("(ii)", master_fd, slave_fd);
-
+ PyErr_SetString(PyExc_NotImplementedError, "openpty not implemented for this build");
+ return NULL;
}
#endif /* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) */