diff --git a/sshuttle/client.py b/sshuttle/client.py index d85ce08..4e4115f 100644 --- a/sshuttle/client.py +++ b/sshuttle/client.py @@ -16,7 +16,7 @@ resolvconf_nameservers from sshuttle.methods import get_method, Features -_extra_fd = os.open('/dev/null', os.O_RDONLY) +_extra_fd = os.open(os.devnull, os.O_RDONLY) def got_signal(signum, frame): @@ -76,7 +76,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() @@ -323,7 +323,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 diff --git a/sshuttle/hostwatch.py b/sshuttle/hostwatch.py index 95a539a..3a671ac 100644 --- a/sshuttle/hostwatch.py +++ b/sshuttle/hostwatch.py @@ -21,7 +21,7 @@ hostnames = {} queue = {} try: - null = open('/dev/null', 'wb') + null = open(os.devnull, 'wb') except IOError as e: log('warning: %s\n' % e) null = os.popen("sh -c 'while read x; do :; done'", 'wb', 4096) diff --git a/sshuttle/ssh.py b/sshuttle/ssh.py index 7691c80..a3dc99f 100644 --- a/sshuttle/ssh.py +++ b/sshuttle/ssh.py @@ -108,7 +108,7 @@ def connect(ssh_cmd, rhostport, python, stderr, options): if python: pycmd = "'%s' -c '%s'" % (python, pyscript) else: - pycmd = ("P=python3.5; $P -V 2>/dev/null || P=python; " + pycmd = ("P=python3.5; $P -V 2>" + os.devnull + " || P=python; " "exec \"$P\" -c '%s'") % pyscript argv = (sshl + portl +