Skip to content

Commit e2c6820

Browse files
committed
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 89e914e commit e2c6820

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

firewall.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import re, errno, socket, select, struct
1+
import re, errno, socket, select, signal, struct
22
import compat.ssubprocess as ssubprocess
33
import helpers, ssyslog
44
from helpers import *
@@ -398,6 +398,11 @@ def main(port, dnsport, syslog):
398398
sys.stdout.write('READY\n')
399399
sys.stdout.flush()
400400

401+
# don't disappear if our controlling terminal or stdout/stderr
402+
# disappears; we still have to clean up.
403+
signal.signal(signal.SIGHUP, signal.SIG_IGN)
404+
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
405+
401406
# ctrl-c shouldn't be passed along to me. When the main sshuttle dies,
402407
# I'll die automatically.
403408
os.setsid()

main.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)