[pypy-commit] pypy win32-cleanup2: validate more fd's
mattip
noreply at buildbot.pypy.org
Tue Apr 17 16:49:41 CEST 2012
Author: Matti Picus <matti.picus at gmail.com>
Branch: win32-cleanup2
Changeset: r54464:b972b2e27935
Date: 2012-04-17 17:49 +0300
http://bitbucket.org/pypy/pypy/changeset/b972b2e27935/
Log: validate more fd's
diff --git a/pypy/rpython/module/ll_os.py b/pypy/rpython/module/ll_os.py
--- a/pypy/rpython/module/ll_os.py
+++ b/pypy/rpython/module/ll_os.py
@@ -397,6 +397,7 @@
os_dup = self.llexternal(underscore_on_windows+'dup', [rffi.INT], rffi.INT)
def dup_llimpl(fd):
+ rposix.validate_fd(fd)
newfd = rffi.cast(lltype.Signed, os_dup(rffi.cast(rffi.INT, fd)))
if newfd == -1:
raise OSError(rposix.get_errno(), "dup failed")
@@ -411,6 +412,7 @@
[rffi.INT, rffi.INT], rffi.INT)
def dup2_llimpl(fd, newfd):
+ rposix.validate_fd(fd)
error = rffi.cast(lltype.Signed, os_dup2(rffi.cast(rffi.INT, fd),
rffi.cast(rffi.INT, newfd)))
if error == -1:
@@ -891,6 +893,7 @@
def os_read_llimpl(fd, count):
if count < 0:
raise OSError(errno.EINVAL, None)
+ rposix.validate_fd(fd)
raw_buf, gc_buf = rffi.alloc_buffer(count)
try:
void_buf = rffi.cast(rffi.VOIDP, raw_buf)
@@ -1048,6 +1051,7 @@
os_fchdir = self.llexternal('fchdir', [rffi.INT], rffi.INT)
def fchdir_llimpl(fd):
+ rposix.validate_fd(fd)
res = rffi.cast(rffi.SIGNED, os_fchdir(rffi.cast(rffi.INT, fd)))
if res < 0:
raise OSError(rposix.get_errno(), "fchdir failed")
@@ -1360,6 +1364,7 @@
os_isatty = self.llexternal(underscore_on_windows+'isatty', [rffi.INT], rffi.INT)
def isatty_llimpl(fd):
+ rposix.validate_fd(fd)
res = rffi.cast(lltype.Signed, os_isatty(rffi.cast(rffi.INT, fd)))
return res != 0
@@ -1537,6 +1542,7 @@
os_umask = self.llexternal(underscore_on_windows+'umask', [rffi.MODE_T], rffi.MODE_T)
def umask_llimpl(fd):
+ rposix.validate_fd(fd)
res = os_umask(rffi.cast(rffi.MODE_T, fd))
return rffi.cast(lltype.Signed, res)
More information about the pypy-commit
mailing list