Skip to content

Commit 2e8381e

Browse files
committed
hostwatch.py: avoid using /dev/null on the server.
According to at least one report, there are some slightly insane servers out there that have /dev/null set to non-user-writable. This is totally broken, but we want sshuttle to work with as many servers as possible, so let's fake it up a bit instead. We don't try to avoid /dev/null on the client; sshuttle needs root access anyway, and if you're root, you can just fix your stupid /dev/null permissions.
1 parent 7d35690 commit 2e8381e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hostwatch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
_smb_ok = True
1414
hostnames = {}
1515
queue = {}
16-
null = open('/dev/null', 'rb+')
16+
try:
17+
null = open('/dev/null', 'wb')
18+
except IOError, e:
19+
log('warning: %s\n' % e)
20+
null = os.popen("sh -c 'while read x; do :; done'", 'wb', 4096)
1721

1822

1923
def _is_ip(s):

0 commit comments

Comments
 (0)