mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
uxpty: remove redundant signal list. (NFC)
In commit 105672e32 I added the pty_backend_exit_signame() function, which constructs the SSH wire name of the signal that terminated the pty session process. I did it by having a sequence of inline #ifdefs for all the translatable signal names, each one guarding the code that expected that signal to be defined in <signal.h>. But there was no need to write all that out longhand, because in the preceding commit 72eca76d2, I made a central list of signal names in sshsignals.h, so all I should have needed to do was to set up the macros that header expects, and let _it_ do the iteration over the locally defined subset of signal ids! So now I do that instead.
This commit is contained in:
parent
22453b46da
commit
639810e825
52
unix/uxpty.c
52
unix/uxpty.c
@ -1561,52 +1561,16 @@ ptrlen pty_backend_exit_signame(Backend *be, char **aux_msg)
|
|||||||
if (sig < 0)
|
if (sig < 0)
|
||||||
return PTRLEN_LITERAL("");
|
return PTRLEN_LITERAL("");
|
||||||
|
|
||||||
#define TRANSLATE_SIGNAL(s) do \
|
#define SIGNAL_SUB(s) { \
|
||||||
{ \
|
|
||||||
if (sig == SIG ## s) \
|
if (sig == SIG ## s) \
|
||||||
return PTRLEN_LITERAL(#s); \
|
return PTRLEN_LITERAL(#s); \
|
||||||
} while (0)
|
}
|
||||||
|
#define SIGNAL_MAIN(s, desc) SIGNAL_SUB(s)
|
||||||
#ifdef SIGABRT
|
#define SIGNALS_LOCAL_ONLY
|
||||||
TRANSLATE_SIGNAL(ABRT);
|
#include "sshsignals.h"
|
||||||
#endif
|
#undef SIGNAL_MAIN
|
||||||
#ifdef SIGALRM
|
#undef SIGNAL_SUB
|
||||||
TRANSLATE_SIGNAL(ALRM);
|
#undef SIGNALS_LOCAL_ONLY
|
||||||
#endif
|
|
||||||
#ifdef SIGFPE
|
|
||||||
TRANSLATE_SIGNAL(FPE);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGHUP
|
|
||||||
TRANSLATE_SIGNAL(HUP);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGILL
|
|
||||||
TRANSLATE_SIGNAL(ILL);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGINT
|
|
||||||
TRANSLATE_SIGNAL(INT);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGKILL
|
|
||||||
TRANSLATE_SIGNAL(KILL);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGPIPE
|
|
||||||
TRANSLATE_SIGNAL(PIPE);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGQUIT
|
|
||||||
TRANSLATE_SIGNAL(QUIT);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGSEGV
|
|
||||||
TRANSLATE_SIGNAL(SEGV);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGTERM
|
|
||||||
TRANSLATE_SIGNAL(TERM);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGUSR1
|
|
||||||
TRANSLATE_SIGNAL(USR1);
|
|
||||||
#endif
|
|
||||||
#ifdef SIGUSR2
|
|
||||||
TRANSLATE_SIGNAL(USR2);
|
|
||||||
#endif
|
|
||||||
#undef TRANSLATE_SIGNAL
|
|
||||||
|
|
||||||
*aux_msg = dupprintf("untranslatable signal number %d: %s",
|
*aux_msg = dupprintf("untranslatable signal number %d: %s",
|
||||||
sig, strsignal(sig));
|
sig, strsignal(sig));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user