summaryrefslogtreecommitdiff
path: root/zen/guid.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-08-15 15:51:34 -0400
committerB Stack <bgstack15@gmail.com>2019-08-15 15:51:39 -0400
commit17994eb3eda9d2be9aad55dae41562ce13531d99 (patch)
treeafc54ec004ab863262f5621fbf282c42fdff29cc /zen/guid.h
parentMerge branch '10.14' into 'master' (diff)
downloadFreeFileSync-17994eb3eda9d2be9aad55dae41562ce13531d99.tar.gz
FreeFileSync-17994eb3eda9d2be9aad55dae41562ce13531d99.tar.bz2
FreeFileSync-17994eb3eda9d2be9aad55dae41562ce13531d99.zip
add upstream 10.15
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