summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-08-22 21:45:42 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-08-22 21:45:42 +0000
commit869e9323652d5ee736bf9798b8f47a861fff30df (patch)
tree5752d7f6601b810430ca469596cd0890c3b8b664 /usr.bin
parent6542dd5296c8780156ab9dd2be94e311eec492f8 (diff)
send signal name (not signal number) in "exit-signal" message; noticed
by galb@vandyke.com
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/session.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index b52f1080135..b628daca748 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/session.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.146 2002/07/30 17:03:55 markus Exp $");
+RCSID("$OpenBSD: session.c,v 1.147 2002/08/22 21:45:41 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -1601,6 +1601,27 @@ session_pty_cleanup(void *session)
PRIVSEP(session_pty_cleanup2(session));
}
+static char *
+sig2name(int sig)
+{
+#define SSH_SIG(x) if (sig == SIG ## x) return #x
+ SSH_SIG(ABRT);
+ SSH_SIG(ALRM);
+ SSH_SIG(FPE);
+ SSH_SIG(HUP);
+ SSH_SIG(ILL);
+ SSH_SIG(INT);
+ SSH_SIG(KILL);
+ SSH_SIG(PIPE);
+ SSH_SIG(QUIT);
+ SSH_SIG(SEGV);
+ SSH_SIG(TERM);
+ SSH_SIG(USR1);
+ SSH_SIG(USR2);
+#undef SSH_SIG
+ return "SIG@openssh.com";
+}
+
static void
session_exit_message(Session *s, int status)
{
@@ -1618,7 +1639,7 @@ session_exit_message(Session *s, int status)
packet_send();
} else if (WIFSIGNALED(status)) {
channel_request_start(s->chanid, "exit-signal", 0);
- packet_put_int(WTERMSIG(status));
+ packet_put_cstring(sig2name(WTERMSIG(status)));
packet_put_char(WCOREDUMP(status));
packet_put_cstring("");
packet_put_cstring("");