[issue27278] py_getrandom() uses an int for syscall() result

Martin Panter report at bugs.python.org
Thu Jun 9 04:16:25 EDT 2016


Martin Panter added the comment:

According to <http://man7.org/linux/man-pages/man2/getrandom.2.html>, getrandom() returns no more than 32 MiB as an int on Linux. Doesn’t that mean you can rely on syscall()’s long return value fitting in an int? Maybe just cast n = (int)sycall(...) to be explicit.

But it does make sense to cap n to LONG_MAX just in case there is some strange platform where it matters :)

----------
nosy: +martin.panter

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27278>
_______________________________________


More information about the Python-bugs-list mailing list