lbry-android-sdk/p4a/pythonforandroid/recipes/python2/patches/disable-openpty.patch

60 lines
1.9 KiB
Diff
Raw Normal View History

2017-08-13 03:24:00 +02:00
--- 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) */