Commit 39425a03 authored by Avery Pennarun's avatar Avery Pennarun Committed by Brian May

firewall: catch SIGHUP and SIGPIPE.

Not sure if this will fix anything, but it might stop the problem reported
on some MacOS versions where the firewall doesn't get cleaned up correctly.
parent 5a39341d
import errno import errno
import socket import socket
import select import select
import signal
import struct import struct
import compat.ssubprocess as ssubprocess import compat.ssubprocess as ssubprocess
import ssyslog import ssyslog
...@@ -565,6 +566,11 @@ def main(port_v6, port_v4, dnsport_v6, dnsport_v4, method, udp, syslog): ...@@ -565,6 +566,11 @@ def main(port_v6, port_v4, dnsport_v6, dnsport_v4, method, udp, syslog):
sys.stdout.write('READY %s\n' % method) sys.stdout.write('READY %s\n' % method)
sys.stdout.flush() sys.stdout.flush()
# don't disappear if our controlling terminal or stdout/stderr
# disappears; we still have to clean up.
signal.signal(signal.SIGHUP, signal.SIG_IGN)
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
# ctrl-c shouldn't be passed along to me. When the main sshuttle dies, # ctrl-c shouldn't be passed along to me. When the main sshuttle dies,
# I'll die automatically. # I'll die automatically.
os.setsid() os.setsid()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment