mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Patch #975056 - fixes for restartable signals on *BSD. In addition,
a few remaining calls to signal() were converted to PyOS_setsig().
This commit is contained in:
parent
7d428788e1
commit
9ceaa72ebe
5 changed files with 28 additions and 48 deletions
|
@ -2903,18 +2903,18 @@ posix_openpty(PyObject *self, PyObject *noargs)
|
|||
master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */
|
||||
if (master_fd < 0)
|
||||
return posix_error();
|
||||
sig_saved = signal(SIGCHLD, SIG_DFL);
|
||||
sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL);
|
||||
/* change permission of slave */
|
||||
if (grantpt(master_fd) < 0) {
|
||||
signal(SIGCHLD, sig_saved);
|
||||
PyOS_setsig(SIGCHLD, sig_saved);
|
||||
return posix_error();
|
||||
}
|
||||
/* unlock slave */
|
||||
if (unlockpt(master_fd) < 0) {
|
||||
signal(SIGCHLD, sig_saved);
|
||||
PyOS_setsig(SIGCHLD, sig_saved);
|
||||
return posix_error();
|
||||
}
|
||||
signal(SIGCHLD, sig_saved);
|
||||
PyOS_setsig(SIGCHLD, sig_saved);
|
||||
slave_name = ptsname(master_fd); /* get name of slave */
|
||||
if (slave_name == NULL)
|
||||
return posix_error();
|
||||
|
|
|
@ -136,9 +136,6 @@ signal_handler(int sig_num)
|
|||
to the Python handler... */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SIGINTERRUPT
|
||||
siginterrupt(sig_num, 1);
|
||||
#endif
|
||||
PyOS_setsig(sig_num, signal_handler);
|
||||
}
|
||||
|
@ -217,9 +214,6 @@ signal_signal(PyObject *self, PyObject *args)
|
|||
}
|
||||
else
|
||||
func = signal_handler;
|
||||
#ifdef HAVE_SIGINTERRUPT
|
||||
siginterrupt(sig_num, 1);
|
||||
#endif
|
||||
if (PyOS_setsig(sig_num, func) == SIG_ERR) {
|
||||
PyErr_SetFromErrno(PyExc_RuntimeError);
|
||||
return NULL;
|
||||
|
|
|
@ -217,7 +217,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
|||
|
||||
/* Generic includes */
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
//#include <signal.h>
|
||||
|
||||
/* Generic socket object definitions and includes */
|
||||
#define PySocket_BUILDING_SOCKET
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue