diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ssh-agent.c | 21 |
2 files changed, 19 insertions, 6 deletions
@@ -1,6 +1,10 @@ | |||
1 | 20010126 | 1 | 20010126 |
2 | - (bal) SSH_PROGRAM vs _PATH_SSH_PROGRAM fix pointed out by Roumen | 2 | - (bal) SSH_PROGRAM vs _PATH_SSH_PROGRAM fix pointed out by Roumen |
3 | Petrov <roumen.petrov@skalasoft.com> | 3 | Petrov <roumen.petrov@skalasoft.com> |
4 | - (bal) OpenBSD Sync | ||
5 | - deraadt@cvs.openbsd.org 2001/01/25 8:06:33 | ||
6 | [ssh-agent.c] | ||
7 | call _exit() in signal handler | ||
4 | 8 | ||
5 | 20010125 | 9 | 20010125 |
6 | - (djm) Sync bsd-* support files: | 10 | - (djm) Sync bsd-* support files: |
diff --git a/ssh-agent.c b/ssh-agent.c index d3713be9b..539f8ce7d 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.47 2001/01/21 19:05:56 markus Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.48 2001/01/25 08:06:33 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: ssh-agent.c,v 1.47 2001/01/21 19:05:56 markus Exp $"); | 40 | RCSID("$OpenBSD: ssh-agent.c,v 1.48 2001/01/25 08:06:33 deraadt Exp $"); |
41 | 41 | ||
42 | #include <openssl/evp.h> | 42 | #include <openssl/evp.h> |
43 | #include <openssl/md5.h> | 43 | #include <openssl/md5.h> |
@@ -683,8 +683,10 @@ check_parent_exists(int sig) | |||
683 | void | 683 | void |
684 | cleanup_socket(void) | 684 | cleanup_socket(void) |
685 | { | 685 | { |
686 | unlink(socket_name); | 686 | if (socket_name[0]) |
687 | rmdir(socket_dir); | 687 | unlink(socket_name); |
688 | if (socket_dir[0]) | ||
689 | rmdir(socket_dir); | ||
688 | } | 690 | } |
689 | 691 | ||
690 | void | 692 | void |
@@ -695,6 +697,13 @@ cleanup_exit(int i) | |||
695 | } | 697 | } |
696 | 698 | ||
697 | void | 699 | void |
700 | cleanup_handler(int sig) | ||
701 | { | ||
702 | cleanup_socket(); | ||
703 | _exit(2); | ||
704 | } | ||
705 | |||
706 | void | ||
698 | usage() | 707 | usage() |
699 | { | 708 | { |
700 | fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION); | 709 | fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION); |
@@ -866,8 +875,8 @@ main(int ac, char **av) | |||
866 | idtab_init(); | 875 | idtab_init(); |
867 | signal(SIGINT, SIG_IGN); | 876 | signal(SIGINT, SIG_IGN); |
868 | signal(SIGPIPE, SIG_IGN); | 877 | signal(SIGPIPE, SIG_IGN); |
869 | signal(SIGHUP, cleanup_exit); | 878 | signal(SIGHUP, cleanup_handler); |
870 | signal(SIGTERM, cleanup_exit); | 879 | signal(SIGTERM, cleanup_handler); |
871 | while (1) { | 880 | while (1) { |
872 | prepare_select(&readsetp, &writesetp, &max_fd); | 881 | prepare_select(&readsetp, &writesetp, &max_fd); |
873 | if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) { | 882 | if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) { |