[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Fix with combined with os.open; doesn't work on Python2.6.



commit 11d976b50b8983174d9fdf8e6a276b1639cd0b95
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Sat Oct 26 13:00:14 2013 +0000

    Fix with combined with os.open; doesn't work on Python2.6.
---
 lib/bridgedb/crypto.py |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/bridgedb/crypto.py b/lib/bridgedb/crypto.py
index ea00733..43b2b79 100644
--- a/lib/bridgedb/crypto.py
+++ b/lib/bridgedb/crypto.py
@@ -44,9 +44,10 @@ def getKey(filename):
     except IOError:
         key = OpenSSL.rand.bytes(32)
         flags = os.O_WRONLY | os.O_TRUNC | os.O_CREAT | getattr(os, "O_BIN", 0)
-        with os.open(filename, flags, 0400) as fd:
-            os.write(fd, key)
-            os.fsync(fd)
+        fd = os.open(filename, flags, 0400)
+        os.write(fd, key)
+        os.fsync(fd)
+        fd.close()
     else:
         key = fh.read()
         fh.close()



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits