[pypy-svn] r45826 - pypy/branch/pypy-more-rtti-inprogress/translator/sandbox

arigo at codespeak.net arigo at codespeak.net
Fri Aug 17 20:03:24 CEST 2007


Author: arigo
Date: Fri Aug 17 20:03:24 2007
New Revision: 45826

Modified:
   pypy/branch/pypy-more-rtti-inprogress/translator/sandbox/sandlib.py
Log:
Some more functions.


Modified: pypy/branch/pypy-more-rtti-inprogress/translator/sandbox/sandlib.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/translator/sandbox/sandlib.py	(original)
+++ pypy/branch/pypy-more-rtti-inprogress/translator/sandbox/sandlib.py	Fri Aug 17 20:03:24 2007
@@ -285,7 +285,10 @@
         if flags & (os.O_RDONLY|os.O_WRONLY|os.O_RDWR) != os.O_RDONLY:
             raise OSError(errno.EPERM, "write access denied")
         # all other flags are ignored
-        f = open(pathname, "rb")
+        try:
+            f = open(pathname, "rb")
+        except IOError, e:
+            raise OSError(e.errno, "open failed")
         return self.allocate_fd(f)
 
     def do_ll_os__ll_os_close(self, fd):
@@ -306,3 +309,10 @@
             if not (0 <= size <= sys.maxint):
                 raise VirtualOSError("invalid read size")
             return f.read(size)
+
+    def do_ll_os__ll_os_getcwd(self):
+        return self.virtual_cwd
+
+    def do_ll_os__ll_os_strerror(self, errnum):
+        # unsure if this shouldn't be considered safeboxsafe
+        return os.strerror(errnum) or ('Unknown error %d' % (errnum,))



More information about the Pypy-commit mailing list