From 3a4b993ec45402e227dafd248e49c23d91f7ece5 Mon Sep 17 00:00:00 2001
From: Shuanglei Tao <tsl0922@gmail.com>
Date: Mon, 8 Jan 2018 19:37:32 +0800
Subject: [PATCH] Fix signal name display

---
 README.md       | 2 +-
 man/ttyd.1      | 2 +-
 man/ttyd.man.md | 2 +-
 src/server.c    | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index da76e79..1b3da39 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ OPTIONS:
     -c, --credential        Credential for Basic Authentication (format: username:password)
     -u, --uid               User id to run with
     -g, --gid               Group id to run with
-    -s, --signal            Signal to send to the command when exit it (default: SIGHUP)
+    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
     -r, --reconnect         Time to reconnect for the client in seconds (default: 10)
     -R, --readonly          Do not allow clients to write to the TTY
     -t, --client-option     Send option to client (format: key=value), repeat to add more options
diff --git a/man/ttyd.1 b/man/ttyd.1
index 79512ca..86cfbe0 100644
--- a/man/ttyd.1
+++ b/man/ttyd.1
@@ -50,7 +50,7 @@ Cross platform: macOS, Linux, FreeBSD/OpenBSD, OpenWrt/LEDE, Windows
 
 .PP
 \-s, \-\-signal <signal string>
-      Signal to send to the command when exit it (default: 9, SIGHUP)
+      Signal to send to the command when exit it (default: 1, SIGHUP)
 
 .PP
 \-r, \-\-reconnect <seconds>
diff --git a/man/ttyd.man.md b/man/ttyd.man.md
index d51fbed..d2e5d2e 100644
--- a/man/ttyd.man.md
+++ b/man/ttyd.man.md
@@ -34,7 +34,7 @@ ttyd 1 "September 2016" ttyd "User Manual"
       Group id to run with
 
   -s, --signal <signal string>
-      Signal to send to the command when exit it (default: 9, SIGHUP)
+      Signal to send to the command when exit it (default: 1, SIGHUP)
 
   -r, --reconnect <seconds>
       Time to reconnect for the client in seconds (default: 10)
diff --git a/src/server.c b/src/server.c
index 3fcd237..c1a17a5 100644
--- a/src/server.c
+++ b/src/server.c
@@ -57,7 +57,7 @@ void print_help() {
                     "    -c, --credential        Credential for Basic Authentication (format: username:password)\n"
                     "    -u, --uid               User id to run with\n"
                     "    -g, --gid               Group id to run with\n"
-                    "    -s, --signal            Signal to send to the command when exit it (default: 9, SIGHUP)\n"
+                    "    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)\n"
                     "    -r, --reconnect         Time to reconnect for the client in seconds (default: 10)\n"
                     "    -R, --readonly          Do not allow clients to write to the TTY\n"
                     "    -t, --client-option     Send option to client (format: key=value), repeat to add more options\n"
@@ -286,7 +286,7 @@ main(int argc, char **argv) {
                 int sig = get_sig(optarg);
                 if (sig > 0) {
                     server->sig_code = sig;
-                    get_sig_name(sig, server->sig_name, sizeof(server->sig_code));
+                    get_sig_name(sig, server->sig_name, sizeof(server->sig_name));
                 } else {
                     fprintf(stderr, "ttyd: invalid signal: %s\n", optarg);
                     return -1;
-- 
2.43.4