mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-03 09:41:30 +01:00
replace path /dev/null by os.devnull
This commit is contained in:
parent
c780597de3
commit
41f5b3e9c1
@ -33,7 +33,7 @@ except AttributeError:
|
||||
except ImportError:
|
||||
import socket
|
||||
|
||||
_extra_fd = os.open('/dev/null', os.O_RDONLY)
|
||||
_extra_fd = os.open(os.devnull, os.O_RDONLY)
|
||||
|
||||
|
||||
def got_signal(signum, frame):
|
||||
@ -93,7 +93,7 @@ def daemonize():
|
||||
# be deleted.
|
||||
signal.signal(signal.SIGTERM, got_signal)
|
||||
|
||||
si = open('/dev/null', 'r+')
|
||||
si = open(os.devnull, 'r+')
|
||||
os.dup2(si.fileno(), 0)
|
||||
os.dup2(si.fileno(), 1)
|
||||
si.close()
|
||||
@ -355,7 +355,7 @@ def onaccept_tcp(listener, method, mux, handlers):
|
||||
sock, srcip = listener.accept()
|
||||
sock.close()
|
||||
finally:
|
||||
_extra_fd = os.open('/dev/null', os.O_RDONLY)
|
||||
_extra_fd = os.open(os.devnull, os.O_RDONLY)
|
||||
return
|
||||
else:
|
||||
raise
|
||||
|
@ -21,7 +21,7 @@ _smb_ok = True
|
||||
hostnames = {}
|
||||
queue = {}
|
||||
try:
|
||||
null = open('/dev/null', 'wb')
|
||||
null = open(os.devnull, 'wb')
|
||||
except IOError:
|
||||
_, e = sys.exc_info()[:2]
|
||||
log('warning: %s\n' % e)
|
||||
|
@ -105,7 +105,7 @@ def _fill_oldctls(prefix):
|
||||
def _sysctl_set(name, val):
|
||||
argv = ['sysctl', '-w', '%s=%s' % (name, val)]
|
||||
debug1('>> %s\n' % ' '.join(argv))
|
||||
return ssubprocess.call(argv, stdout=open('/dev/null', 'w'))
|
||||
return ssubprocess.call(argv, stdout=open(os.devnull, 'w'))
|
||||
|
||||
|
||||
_changedctls = []
|
||||
|
@ -116,8 +116,8 @@ def connect(ssh_cmd, rhostport, python, stderr, options):
|
||||
if python:
|
||||
pycmd = "'%s' -c '%s'" % (python, pyscript)
|
||||
else:
|
||||
pycmd = ("P=python3; $P -V 2>/dev/null || P=python; "
|
||||
"exec \"$P\" -c %s") % quote(pyscript)
|
||||
pycmd = ("P=python3; $P -V 2>%s || P=python; "
|
||||
"exec \"$P\" -c %s") % (os.devnull, quote(pyscript))
|
||||
pycmd = ("exec /bin/sh -c %s" % quote(pycmd))
|
||||
argv = (sshl +
|
||||
portl +
|
||||
|
Loading…
Reference in New Issue
Block a user