summaryrefslogtreecommitdiffstats
path: root/sshuttle
diff options
context:
space:
mode:
authorAbbalYouness <abbal.youness@gmail.com>2018-10-17 09:46:26 +0200
committerBrian May <brian@linuxpenguins.xyz>2018-10-17 20:53:06 +1100
commit41f5b3e9c12808f512b85c715e430fbd109f4742 (patch)
treeacfdf701ddef7676f1b3049500d3148b38f7e2f4 /sshuttle
parentc780597de37ed360826cfa33676dbfd8d89de6f0 (diff)
replace path /dev/null by os.devnull
Diffstat (limited to 'sshuttle')
-rw-r--r--sshuttle/client.py6
-rw-r--r--sshuttle/hostwatch.py2
-rw-r--r--sshuttle/methods/ipfw.py2
-rw-r--r--sshuttle/ssh.py4
4 files changed, 7 insertions, 7 deletions
diff --git a/sshuttle/client.py b/sshuttle/client.py
index 98abcae..e7d8e8f 100644
--- a/sshuttle/client.py
+++ b/sshuttle/client.py
@@ -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
diff --git a/sshuttle/hostwatch.py b/sshuttle/hostwatch.py
index 94b462f..64ff43a 100644
--- a/sshuttle/hostwatch.py
+++ b/sshuttle/hostwatch.py
@@ -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)
diff --git a/sshuttle/methods/ipfw.py b/sshuttle/methods/ipfw.py
index 2a6bec0..2e3bfed 100644
--- a/sshuttle/methods/ipfw.py
+++ b/sshuttle/methods/ipfw.py
@@ -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 = []
diff --git a/sshuttle/ssh.py b/sshuttle/ssh.py
index 5483527..e9d920a 100644
--- a/sshuttle/ssh.py
+++ b/sshuttle/ssh.py
@@ -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 +