From b39cd986edef8541291fbb50feaa8f6e90023703 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Tue, 29 Nov 2016 22:41:44 +0800 Subject: [PATCH] Make ttyd compiles on cygwin --- src/utils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils.c b/src/utils.c index f53b4b8..4d6005a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -22,6 +22,12 @@ const char *sys_signame[NSIG] = { }; #endif +#ifdef __CYGWIN__ +#define SIG_NAME(x) strsignal(x) +#else +#define SIG_NAME(x) sys_signame[x] +#endif + void * t_malloc(size_t size) { if (size == 0) @@ -57,7 +63,7 @@ uppercase(char *str) { int get_sig_name(int sig, char *buf) { - int n = sprintf(buf, "SIG%s", sig < NSIG ? sys_signame[sig] : "unknown"); + int n = sprintf(buf, "SIG%s", sig < NSIG ? SIG_NAME(sig) : "unknown"); uppercase(buf); return n; } @@ -68,7 +74,7 @@ get_sig(const char *sig_name) { return -1; } for (int sig = 1; sig < NSIG; sig++) { - const char *name = sys_signame[sig]; + const char *name = SIG_NAME(sig); if (strcasecmp(name, sig_name + 3) == 0) return sig; } -- 2.43.4