mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
uxpty: remove redundant signal list. (NFC)
In commit105672e32
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 commit72eca76d2
, 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)
|
||||
return PTRLEN_LITERAL("");
|
||||
|
||||
#define TRANSLATE_SIGNAL(s) do \
|
||||
{ \
|
||||
#define SIGNAL_SUB(s) { \
|
||||
if (sig == SIG ## s) \
|
||||
return PTRLEN_LITERAL(#s); \
|
||||
} while (0)
|
||||
|
||||
#ifdef SIGABRT
|
||||
TRANSLATE_SIGNAL(ABRT);
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
TRANSLATE_SIGNAL(ALRM);
|
||||
#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
|
||||
}
|
||||
#define SIGNAL_MAIN(s, desc) SIGNAL_SUB(s)
|
||||
#define SIGNALS_LOCAL_ONLY
|
||||
#include "sshsignals.h"
|
||||
#undef SIGNAL_MAIN
|
||||
#undef SIGNAL_SUB
|
||||
#undef SIGNALS_LOCAL_ONLY
|
||||
|
||||
*aux_msg = dupprintf("untranslatable signal number %d: %s",
|
||||
sig, strsignal(sig));
|
||||
|
Loading…
Reference in New Issue
Block a user