def check_and_adjust_sighandler(self, signame, sigs):
signum = lookup_signum(signame)<EOL>try:<EOL><INDENT>old_handler = signal.getsignal(signum)<EOL><DEDENT>except ValueError:<EOL><INDENT>if signame in self.sigs:<EOL><INDENT>sigs.pop(signame)<EOL>pass<EOL><DEDENT>return None<EOL><DEDENT>if old_handler != self.sigs[signame].handle:<EOL><INDENT>if old_handler not in [signal.SIG_IGN, signal.SIG_DFL]:<EOL><INDENT>sigs[signame].old_handler = old_handler<EOL>pass<EOL><DEDENT>try:<EOL><INDENT>self._orig_set_signal(signum, self.sigs[signame].handle)<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>except KeyError:<EOL><INDENT>return False<EOL><DEDENT>pass<EOL><DEDENT>return True<EOL>
Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or None if error or
not found.