diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-12-31 14:30:26 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-12-31 14:30:26 (GMT) |
commit | c8b2e770cfd59132e447d3445556704b1a49fa89 (patch) | |
tree | 94cff25e400431191ec78e7db7664cdf3616d0a2 | |
parent | c5f5f87f741d122b3d6ca38c681d565d5f05b2b5 (diff) | |
download | cpython-c8b2e770cfd59132e447d3445556704b1a49fa89.zip cpython-c8b2e770cfd59132e447d3445556704b1a49fa89.tar.gz cpython-c8b2e770cfd59132e447d3445556704b1a49fa89.tar.bz2 |
Restore signalhandler in case of error. Fix type of signal handler.
-rw-r--r-- | Modules/posixmodule.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 646229e..ce0bc5b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2744,7 +2744,7 @@ posix_openpty(PyObject *self, PyObject *args) char * slave_name; #endif #if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) - void *sig_saved; + PyOS_sighandler_t sig_saved; #ifdef sun extern char *ptsname(); #endif @@ -2769,10 +2769,16 @@ posix_openpty(PyObject *self, PyObject *args) if (master_fd < 0) return posix_error(); sig_saved = signal(SIGCHLD, SIG_DFL); - if (grantpt(master_fd) < 0) /* change permission of slave */ + /* change permission of slave */ + if (grantpt(master_fd) < 0) { + signal(SIGCHLD, sig_saved); return posix_error(); - if (unlockpt(master_fd) < 0) /* unlock slave */ + } + /* unlock slave */ + if (unlockpt(master_fd) < 0) { + signal(SIGCHLD, sig_saved); return posix_error(); + } signal(SIGCHLD, sig_saved); slave_name = ptsname(master_fd); /* get name of slave */ if (slave_name == NULL) |