summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-25 08:06:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-25 08:06:34 +0000
commit781761390541b469c0b2b93f0f1c7bb73dd19ecd (patch)
tree99e375623826e1426765eb7514c6bfb14bf3cd85 /usr.bin
parent3a4482b58575090e733d0f7a0e29112aee990be5 (diff)
call _exit() in signal handler
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/ssh-agent.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index d1739e273f9..9eb1615c614 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.47 2001/01/21 19:05:56 markus Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.48 2001/01/25 08:06:33 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -37,7 +37,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.47 2001/01/21 19:05:56 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.48 2001/01/25 08:06:33 deraadt Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -679,8 +679,10 @@ check_parent_exists(int sig)
void
cleanup_socket(void)
{
- unlink(socket_name);
- rmdir(socket_dir);
+ if (socket_name[0])
+ unlink(socket_name);
+ if (socket_dir[0])
+ rmdir(socket_dir);
}
void
@@ -691,6 +693,13 @@ cleanup_exit(int i)
}
void
+cleanup_handler(int sig)
+{
+ cleanup_socket();
+ _exit(2);
+}
+
+void
usage()
{
fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION);
@@ -851,8 +860,8 @@ main(int ac, char **av)
idtab_init();
signal(SIGINT, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
- signal(SIGHUP, cleanup_exit);
- signal(SIGTERM, cleanup_exit);
+ signal(SIGHUP, cleanup_handler);
+ signal(SIGTERM, cleanup_handler);
while (1) {
prepare_select(&readsetp, &writesetp, &max_fd);
if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) {