[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] gpg.py: set O_NONBLOCK for writing



We need O_NONBLOCK as otherwise os.write() would block for large input.

Signed-off-by: Ansgar Burchardt <ansgar@debian.org>
---
 daklib/gpg.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/daklib/gpg.py b/daklib/gpg.py
index 0e080df..62bfe09 100644
--- a/daklib/gpg.py
+++ b/daklib/gpg.py
@@ -114,6 +114,10 @@ class SignedFile(object):
                     raise GpgException("No valid signature found. (GPG exited with status code %s)\n%s" % (exit_code, self.stderr))
 
     def _do_io(self, read, write):
+        for fd in write.keys():
+            old = fcntl.fcntl(fd, fcntl.F_GETFL)
+            fcntl.fcntl(fd, fcntl.F_SETFL, old | os.O_NONBLOCK)
+
         read_lines = dict( (fd, []) for fd in read )
         write_pos = dict( (fd, 0) for fd in write )
 
-- 
1.7.2.5


Reply to: