[pypy-svn] r45190 - pypy/dist/pypy/translator/c

arigo at codespeak.net arigo at codespeak.net
Wed Jul 18 17:25:09 CEST 2007


Author: arigo
Date: Wed Jul 18 17:25:09 2007
New Revision: 45190

Modified:
   pypy/dist/pypy/translator/c/sandbox.py
Log:
Better safe than sorry: although it shouldn't occur,
prevent a similar infinite loop in 'write'.


Modified: pypy/dist/pypy/translator/c/sandbox.py
==============================================================================
--- pypy/dist/pypy/translator/c/sandbox.py	(original)
+++ pypy/dist/pypy/translator/c/sandbox.py	Wed Jul 18 17:25:09 2007
@@ -39,6 +39,8 @@
         count = rffi.cast(lltype.Signed, ll_write_not_sandboxed(fd, buf, size))
         if count < 0:
             raise IOError
+        if count == 0:
+            raise EOFError
         length -= count
         buf = lltype.direct_ptradd(lltype.direct_arrayitems(buf), count)
         buf = rffi.cast(rffi.CCHARP, buf)



More information about the Pypy-commit mailing list