diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-02-21 16:44:05 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-02-21 16:44:05 (GMT) |
commit | f2f373f5931be48efc3f6fa2c2faa1cca79dce75 (patch) | |
tree | 87facdec6423b6282ad5c4e2cf30e124d4a5de40 /Python/random.c | |
parent | 18d1924987d75ef43a429fe4b6f05df2c308ec2a (diff) | |
download | cpython-f2f373f5931be48efc3f6fa2c2faa1cca79dce75.zip cpython-f2f373f5931be48efc3f6fa2c2faa1cca79dce75.tar.gz cpython-f2f373f5931be48efc3f6fa2c2faa1cca79dce75.tar.bz2 |
Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
Diffstat (limited to 'Python/random.c')
-rw-r--r-- | Python/random.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/random.c b/Python/random.c index 93d300d..031d887 100644 --- a/Python/random.c +++ b/Python/random.c @@ -139,14 +139,14 @@ dev_urandom_python(char *buffer, Py_ssize_t size) { int fd; Py_ssize_t n; - struct stat st; + struct _Py_stat_struct st; if (size <= 0) return 0; if (urandom_cache.fd >= 0) { /* Does the fd point to the same thing as before? (issue #21207) */ - if (fstat(urandom_cache.fd, &st) + if (_Py_fstat(urandom_cache.fd, &st) || st.st_dev != urandom_cache.st_dev || st.st_ino != urandom_cache.st_ino) { /* Something changed: forget the cached fd (but don't close it, @@ -178,7 +178,7 @@ dev_urandom_python(char *buffer, Py_ssize_t size) fd = urandom_cache.fd; } else { - if (fstat(fd, &st)) { + if (_Py_fstat(fd, &st)) { PyErr_SetFromErrno(PyExc_OSError); close(fd); return -1; |