<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Errors in read() are not handled in WTF::cryptographicallyRandomValuesFromOS."
href="https://bugs.webkit.org/show_bug.cgi?id=146473#c11">Comment # 11</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Errors in read() are not handled in WTF::cryptographicallyRandomValuesFromOS."
href="https://bugs.webkit.org/show_bug.cgi?id=146473">bug 146473</a>
from <span class="vcard"><a class="email" href="mailto:ggaren@apple.com" title="Geoffrey Garen <ggaren@apple.com>"> <span class="fn">Geoffrey Garen</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=255869&action=diff" name="attach_255869" title="Patch">attachment 255869</a> <a href="attachment.cgi?id=255869&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=255869&action=review">https://bugs.webkit.org/attachment.cgi?id=255869&action=review</a>
<span class="quote">> Source/WTF/wtf/OSRandomSource.cpp:67
> + if (currentRead < 0 && !(errno == EAGAIN || errno == EINTR))</span >
I think it would be nicer to check for -1 explicitly, rather than implicitly by including all negatives in the test. The documentation states that read will return -1, 0, or a positive number, and it is nice to be precise.
You can simplify the logic here a bit and avoid testing currentRead twice like so:
if (currentRead == -1) {
if (!(errno == EAGAIN || errno == EINTR))
crashUnableToReadFromURandom();
} else
amountRead += currentRead;
This helps to clearly separate the failure case from the success case.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>