Skip to content

Commit 39425a0

Browse files
apenwarrbrianmay
authored andcommitted
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.
1 parent 5a39341 commit 39425a0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/firewall.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import errno
22
import socket
33
import select
4+
import signal
45
import struct
56
import compat.ssubprocess as ssubprocess
67
import ssyslog
@@ -565,6 +566,11 @@ def main(port_v6, port_v4, dnsport_v6, dnsport_v4, method, udp, syslog):
565566
sys.stdout.write('READY %s\n' % method)
566567
sys.stdout.flush()
567568

569+
# don't disappear if our controlling terminal or stdout/stderr
570+
# disappears; we still have to clean up.
571+
signal.signal(signal.SIGHUP, signal.SIG_IGN)
572+
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
573+
568574
# ctrl-c shouldn't be passed along to me. When the main sshuttle dies,
569575
# I'll die automatically.
570576
os.setsid()

0 commit comments

Comments
 (0)