Include an error code when getRandomBytes failed.

In a rare situation, the function can fail (e.g. it fails if it cannot
open /dev/urandom.)

llvm-svn: 316726
This commit is contained in:
Rui Ueyama 2017-10-27 01:25:29 +00:00
parent 6853d94e2f
commit 88f0568ce5
1 changed files with 2 additions and 2 deletions

View File

@ -386,8 +386,8 @@ void BuildIdSection::writeBuildId(ArrayRef<uint8_t> Buf) {
});
break;
case BuildIdKind::Uuid:
if (getRandomBytes(HashBuf, HashSize))
error("entropy source failure");
if (auto EC = getRandomBytes(HashBuf, HashSize))
error("entropy source failure: " + EC.message());
break;
case BuildIdKind::Hexstring:
memcpy(HashBuf, Config->BuildIdVector.data(), Config->BuildIdVector.size());