summaryrefslogtreecommitdiff
path: root/zen/guid.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-09-03 20:50:36 +0000
committerB Stack <bgstack15@gmail.com>2019-09-03 20:50:36 +0000
commit89b5c8eb6012b7b4560958ad3c1aa5b187dafc94 (patch)
treeafc54ec004ab863262f5621fbf282c42fdff29cc /zen/guid.h
parentMerge branch '10.14' into 'master' (diff)
parentadd upstream 10.15 (diff)
downloadFreeFileSync-89b5c8eb6012b7b4560958ad3c1aa5b187dafc94.tar.gz
FreeFileSync-89b5c8eb6012b7b4560958ad3c1aa5b187dafc94.tar.bz2
FreeFileSync-89b5c8eb6012b7b4560958ad3c1aa5b187dafc94.zip
Merge branch '10.15' into 'master'10.15
add upstream 10.15 See merge request opensource-tracking/FreeFileSync!12
Diffstat (limited to 'zen/guid.h')
-rw-r--r--zen/guid.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/zen/guid.h b/zen/guid.h
index c89e8082..657ed07a 100644
--- a/zen/guid.h
+++ b/zen/guid.h
@@ -8,7 +8,7 @@
#define GUID_H_80425780237502345
#include <fcntl.h> //open
- #include <unistd.h> //close
+ #include <unistd.h> //close, getentropy
#include <zen/sys_error.h>
//#include <uuid/uuid.h> -> uuid_generate(), uuid_unparse(); avoid additional dependency for "sudo apt-get install uuid-dev"
@@ -19,6 +19,11 @@ inline
std::string generateGUID() //creates a 16-byte GUID
{
std::string guid(16, '\0');
+
+#ifndef __GLIBC__
+#error Where is GLIB?
+#endif
+
#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." +
bgstack15