[lld] r316726 - Include an error code when getRandomBytes failed.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 18:25:29 PDT 2017
Author: ruiu
Date: Thu Oct 26 18:25:29 2017
New Revision: 316726
URL: http://llvm.org/viewvc/llvm-project?rev=316726&view=rev
Log:
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.)
Modified:
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=316726&r1=316725&r2=316726&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Oct 26 18:25:29 2017
@@ -386,8 +386,8 @@ void BuildIdSection::writeBuildId(ArrayR
});
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());
More information about the llvm-commits
mailing list