summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-07-20 14:46:12 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-07-20 14:46:12 +0000
commitfc223656d8469d078ebca648bf97951f04d4536d (patch)
tree00a8542e0cda40e2d3e32f4a9260159a6928ea8b /usr.bin
parent922805fa1b46088c534de8b16c27d252ada6c4ba (diff)
do not exit() from signal handlers; ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/ssh-agent.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index e42b0005380..60086c2760d 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.67 2001/07/18 21:40:40 stevesk Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.68 2001/07/20 14:46:11 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -36,7 +36,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.67 2001/07/18 21:40:40 stevesk Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.68 2001/07/20 14:46:11 markus Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -775,20 +775,6 @@ after_select(fd_set *readset, fd_set *writeset)
}
static void
-check_parent_exists(int sig)
-{
- int save_errno = errno;
-
- if (parent_pid != -1 && kill(parent_pid, 0) < 0) {
- /* printf("Parent has died - Authentication agent exiting.\n"); */
- exit(1);
- }
- signal(SIGALRM, check_parent_exists);
- alarm(10);
- errno = save_errno;
-}
-
-static void
cleanup_socket(void)
{
if (socket_name[0])
@@ -812,6 +798,20 @@ cleanup_handler(int sig)
}
static void
+check_parent_exists(int sig)
+{
+ int save_errno = errno;
+
+ if (parent_pid != -1 && kill(parent_pid, 0) < 0) {
+ /* printf("Parent has died - Authentication agent exiting.\n"); */
+ cleanup_handler(sig); /* safe */
+ }
+ signal(SIGALRM, check_parent_exists);
+ alarm(10);
+ errno = save_errno;
+}
+
+static void
usage(void)
{
fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION);