Whamcloud - gitweb
ChangeLog, gen_uuid.c:
authorTheodore Ts'o <tytso@mit.edu>
Mon, 3 Apr 2000 16:51:06 +0000 (16:51 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 3 Apr 2000 16:51:06 +0000 (16:51 +0000)
  gen_uuid.c (get_clock): Fix bug where the last timeval wasn't getting
   set, causing potentially duplicate UUID's to be generated.

lib/uuid/ChangeLog
lib/uuid/gen_uuid.c

index c3944af..fd4acd8 100644 (file)
@@ -1,3 +1,9 @@
+2000-04-03  Theodore Ts'o  <tytso@valinux.com>
+
+       * gen_uuid.c (get_clock): Fix bug where the last timeval wasn't
+               getting set, causing potentially duplicate UUID's to be
+               generated.
+
 2000-03-12  Theodore Ts'o  <tytso@valinux.com>
 
        * gen_uuid.c (get_random_bytes): Make more paranoid about
index eb25bed..464cf01 100644 (file)
@@ -183,14 +183,17 @@ try_again:
             (tv.tv_usec < last.tv_usec))) {
                clock_seq = (clock_seq+1) & 0x1FFF;
                adjustment = 0;
+               last = tv;
        } else if ((tv.tv_sec == last.tv_sec) &&
            (tv.tv_usec == last.tv_usec)) {
                if (adjustment >= MAX_ADJUSTMENT)
                        goto try_again;
                adjustment++;
-       } else
+       } else {
                adjustment = 0;
-       
+               last = tv;
+       }
+               
        clock_reg = tv.tv_usec*10 + adjustment;
        clock_reg += ((unsigned long long) tv.tv_sec)*10000000;
        clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;