summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-agent.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2003-09-19 11:29:40 +0000
committermarkus <markus@openbsd.org>2003-09-19 11:29:40 +0000
commita99701ad40c3e1af1e1e83d402620b923cf54ca0 (patch)
treefca03d868cafb163d6ac2953b08cc48792dbd6fd /usr.bin/ssh/ssh-agent.c
parentReplace an oops by myself - standard C library will be llib-lc.ln, not (diff)
downloadwireguard-openbsd-a99701ad40c3e1af1e1e83d402620b923cf54ca0.tar.xz
wireguard-openbsd-a99701ad40c3e1af1e1e83d402620b923cf54ca0.zip
provide a ssh-agent specific fatal() function; ok deraadt
Diffstat (limited to 'usr.bin/ssh/ssh-agent.c')
-rw-r--r--usr.bin/ssh/ssh-agent.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index 344dcd0deea..542ac9e0ba2 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -35,7 +35,7 @@
#include "includes.h"
#include <sys/queue.h>
-RCSID("$OpenBSD: ssh-agent.c,v 1.112 2003/09/18 08:49:45 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.113 2003/09/19 11:29:40 markus Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -945,7 +945,7 @@ after_select(fd_set *readset, fd_set *writeset)
}
static void
-cleanup_socket(void *p)
+cleanup_socket(void)
{
if (socket_name[0])
unlink(socket_name);
@@ -956,17 +956,28 @@ cleanup_socket(void *p)
static void
cleanup_exit(int i)
{
- cleanup_socket(NULL);
- exit(i);
+ cleanup_socket();
+ _exit(i);
}
static void
cleanup_handler(int sig)
{
- cleanup_socket(NULL);
+ cleanup_socket();
_exit(2);
}
+void
+fatal(const char *fmt,...)
+{
+ va_list args;
+ va_start(args, fmt);
+ do_log(SYSLOG_LEVEL_FATAL, fmt, args);
+ va_end(args);
+ cleanup_socket();
+ _exit(255);
+}
+
static void
check_parent_exists(int sig)
{
@@ -1185,7 +1196,6 @@ main(int ac, char **av)
}
skip:
- fatal_add_cleanup(cleanup_socket, NULL);
new_socket(AUTH_SOCKET, sock);
if (ac > 0) {
signal(SIGALRM, check_parent_exists);