summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-09-04 16:39:02 +1000
committerDamien Miller <djm@mindrot.org>2002-09-04 16:39:02 +1000
commit5a80bba86f60c2ba8447c764ad2fd4e6207b544a (patch)
treec397567468ca3b89ed457d708a397fe2beb123ca /session.c
parentde6f2de8ad528cd8cdfb4b4dc5de9e7ba086c957 (diff)
- markus@cvs.openbsd.org 2002/08/22 21:45:41
[session.c] send signal name (not signal number) in "exit-signal" message; noticed by galb@vandyke.com
Diffstat (limited to 'session.c')
-rw-r--r--session.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/session.c b/session.c
index f2a1bf01..0e78aca3 100644
--- a/session.c
+++ b/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"
@@ -1809,6 +1809,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)
{
@@ -1826,7 +1847,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)));
#ifdef WCOREDUMP
packet_put_char(WCOREDUMP(status));
#else /* WCOREDUMP */