pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2016-09-13
2016-09-13 14:11:24 by Henrik Grubbström (Grubba) <grubba@grubba.org>
52186c09aa81d70dfb54ad1b86c9d5f2cb864282 (
9
lines) (+
7
/-
2
)
[
Show
|
Annotate
]
Branch:
8.1
RandomSystem: Improved robustness against EINTR.
2346:
Pike_error("Failed to create random data.\n"); } #else /* !__NT__ */
-
if
( random_fd==-1 )
+
while
( random_fd
==
-1 )
{ random_fd = open("/dev/urandom", O_RDONLY);
-
if( random_fd==-1 )
+
if( random_fd==-1 )
{
+
if (errno == EINTR) continue; /* Retry */
Pike_error("Failed to open /dev/urandom.\n"); }
-
+
}
struct pike_string *ret = begin_shared_string(len); char* str = ret->str;
2359:
{ int sz = read(random_fd, str, len); if (sz < 0) {
+
if (errno == EINTR) continue; /* Retry */
+
free_string(ret); /* Attempt to recover on next call. */