aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/uuid/gen_uuid.c
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/uuid/gen_uuid.c')
-rw-r--r--e2fsprogs/uuid/gen_uuid.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/e2fsprogs/uuid/gen_uuid.c b/e2fsprogs/uuid/gen_uuid.c
index 52328cfc4..fca3ebe91 100644
--- a/e2fsprogs/uuid/gen_uuid.c
+++ b/e2fsprogs/uuid/gen_uuid.c
@@ -16,7 +16,7 @@
16 * 3. The name of the author may not be used to endorse or promote 16 * 3. The name of the author may not be used to endorse or promote
17 * products derived from this software without specific prior 17 * products derived from this software without specific prior
18 * written permission. 18 * written permission.
19 * 19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
@@ -63,8 +63,8 @@
63#include "uuidP.h" 63#include "uuidP.h"
64 64
65#ifdef HAVE_SRANDOM 65#ifdef HAVE_SRANDOM
66#define srand(x) srandom(x) 66#define srand(x) srandom(x)
67#define rand() random() 67#define rand() random()
68#endif 68#endif
69 69
70static int get_random_fd(void) 70static int get_random_fd(void)
@@ -111,7 +111,7 @@ static void get_random_bytes(void *buf, int nbytes)
111 lose_counter = 0; 111 lose_counter = 0;
112 } 112 }
113 } 113 }
114 114
115 /* 115 /*
116 * We do this all the time, but this is the only source of 116 * We do this all the time, but this is the only source of
117 * randomness if /dev/random/urandom is out to lunch. 117 * randomness if /dev/random/urandom is out to lunch.
@@ -127,12 +127,12 @@ static void get_random_bytes(void *buf, int nbytes)
127static int get_node_id(unsigned char *node_id) 127static int get_node_id(unsigned char *node_id)
128{ 128{
129#ifdef HAVE_NET_IF_H 129#ifdef HAVE_NET_IF_H
130 int sd; 130 int sd;
131 struct ifreq ifr, *ifrp; 131 struct ifreq ifr, *ifrp;
132 struct ifconf ifc; 132 struct ifconf ifc;
133 char buf[1024]; 133 char buf[1024];
134 int n, i; 134 int n, i;
135 unsigned char *a; 135 unsigned char *a;
136#ifdef HAVE_NET_IF_DL_H 136#ifdef HAVE_NET_IF_DL_H
137 struct sockaddr_dl *sdlp; 137 struct sockaddr_dl *sdlp;
138#endif 138#endif
@@ -140,7 +140,7 @@ static int get_node_id(unsigned char *node_id)
140/* 140/*
141 * BSD 4.4 defines the size of an ifreq to be 141 * BSD 4.4 defines the size of an ifreq to be
142 * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len 142 * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
143 * However, under earlier systems, sa_len isn't present, so the size is 143 * However, under earlier systems, sa_len isn't present, so the size is
144 * just sizeof(struct ifreq) 144 * just sizeof(struct ifreq)
145 */ 145 */
146#ifdef HAVE_SA_LEN 146#ifdef HAVE_SA_LEN
@@ -214,9 +214,9 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_cl
214 static int adjustment = 0; 214 static int adjustment = 0;
215 static struct timeval last = {0, 0}; 215 static struct timeval last = {0, 0};
216 static uint16_t clock_seq; 216 static uint16_t clock_seq;
217 struct timeval tv; 217 struct timeval tv;
218 unsigned long long clock_reg; 218 unsigned long long clock_reg;
219 219
220try_again: 220try_again:
221 gettimeofday(&tv, 0); 221 gettimeofday(&tv, 0);
222 if ((last.tv_sec == 0) && (last.tv_usec == 0)) { 222 if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
@@ -240,7 +240,7 @@ try_again:
240 adjustment = 0; 240 adjustment = 0;
241 last = tv; 241 last = tv;
242 } 242 }
243 243
244 clock_reg = tv.tv_usec*10 + adjustment; 244 clock_reg = tv.tv_usec*10 + adjustment;
245 clock_reg += ((unsigned long long) tv.tv_sec)*10000000; 245 clock_reg += ((unsigned long long) tv.tv_sec)*10000000;
246 clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; 246 clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;