diff options
author | Avery Pennarun <apenwarr@gmail.com> | 2011-03-14 18:51:13 -0700 |
---|---|---|
committer | Avery Pennarun <apenwarr@gmail.com> | 2011-03-14 18:57:06 -0700 |
commit | 2e8381ecda445f07587b1f475031cbce01657c4d (patch) | |
tree | 60fbd713979685eafdac22603c2165571a401032 | |
parent | 7d35690e4155e49e0b7820a613c698266eccc052 (diff) |
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.
-rw-r--r-- | hostwatch.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hostwatch.py b/hostwatch.py index d77a58f..66e7461 100644 --- a/hostwatch.py +++ b/hostwatch.py @@ -13,7 +13,11 @@ _nmb_ok = True _smb_ok = True hostnames = {} queue = {} -null = open('/dev/null', 'rb+') +try: + null = open('/dev/null', 'wb') +except IOError, e: + log('warning: %s\n' % e) + null = os.popen("sh -c 'while read x; do :; done'", 'wb', 4096) def _is_ip(s): |