summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-10-03 21:02:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-10-03 21:02:13 +0000
commitee06ef083f92db145a6a98262367987f0d0e8c11 (patch)
treebee2410bde2b2a74e45a653dc2c8eaa94ce60873 /usr.bin/ssh
parentb565e6f0e6d21a82e4a01ad1d9a49f1eb3a61ab3 (diff)
errno trashing in signal handlers
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/serverloop.c2
-rw-r--r--usr.bin/ssh/sshd.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index 063e0f42088..0545b04747d 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -49,6 +49,7 @@ static volatile int child_wait_status; /* Status from wait(). */
void sigchld_handler(int sig)
{
+ int save_errno = errno;
int wait_pid;
debug("Received SIGCHLD.");
wait_pid = wait((int *)&child_wait_status);
@@ -62,6 +63,7 @@ void sigchld_handler(int sig)
child_terminated = 1;
}
signal(SIGCHLD, sigchld_handler);
+ errno = save_errno;
}
/* Process any buffered packets that have been received from the client. */
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 2ae61774f72..5099513cdf4 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -18,7 +18,7 @@ agent connections.
*/
#include "includes.h"
-RCSID("$Id: sshd.c,v 1.17 1999/10/03 19:22:39 deraadt Exp $");
+RCSID("$Id: sshd.c,v 1.18 1999/10/03 21:02:12 deraadt Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -167,9 +167,11 @@ void sigterm_handler(int sig)
void main_sigchld_handler(int sig)
{
+ int save_errno = errno;
int status;
wait(&status);
signal(SIGCHLD, main_sigchld_handler);
+ errno = save_errno;
}
/* Signal handler for the alarm after the login grace period has expired. */
@@ -190,6 +192,8 @@ void grace_alarm_handler(int sig)
void key_regeneration_alarm(int sig)
{
+ int save_errno = errno;
+
/* Check if we should generate a new key. */
if (key_used)
{
@@ -214,6 +218,7 @@ void key_regeneration_alarm(int sig)
/* Reschedule the alarm. */
signal(SIGALRM, key_regeneration_alarm);
alarm(options.key_regeneration_time);
+ errno = save_errno;
}
/* Main program for the daemon. */