return err;
}
-static void block_signal(int sig, int block_it) {
- sigset_t ss;
-
- sigemptyset(&ss);
- sigaddset(&ss, sig);
- if(sigprocmask(block_it ? SIG_BLOCK : SIG_UNBLOCK, &ss, 0) < 0) {
- perror("sigprocmask");
- exit(1);
- }
-}
-
/*
* This function retrieves the character set encoding of a font. It
* returns the character set without the X11 hack (in case the user
/*
* SIGINT and SIGQUIT may have been set to ignored by our
* parent, particularly by things like sh -c 'pterm &' and
- * some window managers. SIGCHLD, meanwhile, has been
- * tinkered with by the watchdog process. Reverse all this
- * for our child process.
+ * some window managers. SIGCHLD, meanwhile, was blocked
+ * during pt_main() startup. Reverse all this for our child
+ * process.
*/
putty_signal(SIGINT, SIG_DFL);
putty_signal(SIGQUIT, SIG_DFL);
- {
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set, SIGCHLD);
- sigprocmask(SIG_UNBLOCK, &set, NULL);
- }
+ block_signal(SIGCHLD, 0);
if (pty_argv)
execvp(pty_argv[0], pty_argv);
else {
#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
/*
* Calling signal() is a non-portable, as it varies in meaning between
return old.sa_handler;
}
+void block_signal(int sig, int block_it)
+{
+ sigset_t ss;
+
+ sigemptyset(&ss);
+ sigaddset(&ss, sig);
+ if(sigprocmask(block_it ? SIG_BLOCK : SIG_UNBLOCK, &ss, 0) < 0) {
+ perror("sigprocmask");
+ exit(1);
+ }
+}
+
/*
Local Variables:
c-basic-offset:4
#define strnicmp strncasecmp
#define stricmp strcasecmp
-/* BSD-semantics version of signal() */
+/* BSD-semantics version of signal(), and another helpful function */
void (*putty_signal(int sig, void (*func)(int)))(int);
+void block_signal(int sig, int block_it);
/*
* Exports from unicode.c.