From 2737f9cbd09c42fd7cae4be2c3e3016603c05363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Sat, 9 Feb 2013 15:12:56 +0100 Subject: [PATCH] Initialize the random generator for the internal guid generator When uuid/uuid.h is not available, mkntfs uses a home-made guid generator. Better initialize the random generator to get a random guid. --- libntfs-3g/security.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs-3g/security.c b/libntfs-3g/security.c index 57e7331e..a42b38b6 100644 --- a/libntfs-3g/security.c +++ b/libntfs-3g/security.c @@ -367,6 +367,8 @@ void ntfs_generate_guid(GUID *guid) unsigned int i; u8 *p = (u8 *)guid; + /* this is called at most once from mkntfs */ + srandom(time((time_t*)NULL) ^ (getpid() << 16)); for (i = 0; i < sizeof(GUID); i++) { p[i] = (u8)(random() & 0xFF); if (i == 7)