summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index e1e6cae9b..28a39a934 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/sys-queue.h" 37#include "openbsd-compat/sys-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.112 2003/09/18 08:49:45 markus Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.113 2003/09/19 11:29:40 markus Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -949,7 +949,7 @@ after_select(fd_set *readset, fd_set *writeset)
949} 949}
950 950
951static void 951static void
952cleanup_socket(void *p) 952cleanup_socket(void)
953{ 953{
954 if (socket_name[0]) 954 if (socket_name[0])
955 unlink(socket_name); 955 unlink(socket_name);
@@ -960,17 +960,28 @@ cleanup_socket(void *p)
960static void 960static void
961cleanup_exit(int i) 961cleanup_exit(int i)
962{ 962{
963 cleanup_socket(NULL); 963 cleanup_socket();
964 exit(i); 964 _exit(i);
965} 965}
966 966
967static void 967static void
968cleanup_handler(int sig) 968cleanup_handler(int sig)
969{ 969{
970 cleanup_socket(NULL); 970 cleanup_socket();
971 _exit(2); 971 _exit(2);
972} 972}
973 973
974void
975fatal(const char *fmt,...)
976{
977 va_list args;
978 va_start(args, fmt);
979 do_log(SYSLOG_LEVEL_FATAL, fmt, args);
980 va_end(args);
981 cleanup_socket();
982 _exit(255);
983}
984
974static void 985static void
975check_parent_exists(int sig) 986check_parent_exists(int sig)
976{ 987{
@@ -1209,7 +1220,6 @@ main(int ac, char **av)
1209#endif 1220#endif
1210 1221
1211skip: 1222skip:
1212 fatal_add_cleanup(cleanup_socket, NULL);
1213 new_socket(AUTH_SOCKET, sock); 1223 new_socket(AUTH_SOCKET, sock);
1214 if (ac > 0) { 1224 if (ac > 0) {
1215 mysignal(SIGALRM, check_parent_exists); 1225 mysignal(SIGALRM, check_parent_exists);