summaryrefslogtreecommitdiff
path: root/zen/guid.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2020-03-20 22:34:51 +0000
committerDaniel Wilhelm <shieldwed@outlook.com>2020-03-20 22:34:51 +0000
commit543ddcd795ba2fa44676b59135a745f51f28a8da (patch)
tree5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /zen/guid.h
parentMerge branch '10.20' into 'master' (diff)
parentadd upstream 10.21 (diff)
downloadFreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.gz
FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.bz2
FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.zip
Merge branch '10.21' into 'master'10.21
add upstream 10.21 See merge request opensource-tracking/FreeFileSync!18
Diffstat (limited to 'zen/guid.h')
-rw-r--r--zen/guid.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/zen/guid.h b/zen/guid.h
index 657ed07a..88059be8 100644
--- a/zen/guid.h
+++ b/zen/guid.h
@@ -26,8 +26,8 @@ std::string generateGUID() //creates a 16-byte GUID
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25) //getentropy() requires glibc 2.25 (ldd --version) PS: CentOS 7 is on 2.17
if (::getentropy(&guid[0], guid.size()) != 0) //"The maximum permitted value for the length argument is 256"
- throw std::runtime_error(std::string(__FILE__) + "[" + numberTo<std::string>(__LINE__) + "] Failed to generate GUID." +
- "\n" + utfTo<std::string>(formatSystemError(L"getentropy", errno)));
+ throw std::runtime_error(std::string(__FILE__) + '[' + numberTo<std::string>(__LINE__) + "] Failed to generate GUID." + "\n\n" +
+ utfTo<std::string>(formatSystemError(L"getentropy", errno)));
#else
class RandomGeneratorPosix
{
@@ -35,8 +35,8 @@ std::string generateGUID() //creates a 16-byte GUID
RandomGeneratorPosix()
{
if (fd_ == -1)
- throw std::runtime_error(std::string(__FILE__) + "[" + numberTo<std::string>(__LINE__) + "] Failed to generate GUID." +
- "\n" + utfTo<std::string>(formatSystemError(L"open", errno)));
+ throw std::runtime_error(std::string(__FILE__) + '[' + numberTo<std::string>(__LINE__) + "] Failed to generate GUID." + "\n\n" +
+ utfTo<std::string>(formatSystemError(L"open", errno)));
}
~RandomGeneratorPosix() { ::close(fd_); }
@@ -47,8 +47,8 @@ std::string generateGUID() //creates a 16-byte GUID
{
const ssize_t bytesRead = ::read(fd_, static_cast<char*>(buf) + offset, size - offset);
if (bytesRead < 1) //0 means EOF => error in this context (should check for buffer overflow, too?)
- throw std::runtime_error(std::string(__FILE__) + "[" + numberTo<std::string>(__LINE__) + "] Failed to generate GUID." +
- "\n" + utfTo<std::string>(formatSystemError(L"read", bytesRead < 0 ? errno : EIO)));
+ throw std::runtime_error(std::string(__FILE__) + '[' + numberTo<std::string>(__LINE__) + "] Failed to generate GUID." + "\n\n" +
+ utfTo<std::string>(formatSystemError(L"read", bytesRead < 0 ? errno : EIO)));
offset += bytesRead;
assert(offset <= size);
}
bgstack15